|
Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
|
Sonde::Expected, Sonde::Unexpected and Sonde::Error: results that are a value or an error (design 0031). More...
#include <sonde/global.h>#include <QtCore/QString>#include <optional>#include <type_traits>#include <utility>#include <variant>Go to the source code of this file.
Classes | |
| struct | Sonde::Error |
| Why something failed. More... | |
| class | Sonde::Unexpected< E > |
| An error, to construct an Expected from, as std::unexpected. More... | |
| class | Sonde::Expected< T, E > |
A value of type T, or an error of type E, as std::expected. More... | |
| class | Sonde::Expected< void, E > |
Success, or an error of type E, as std::expected<void, E>. More... | |
| struct | Sonde::Detail::IsExpected< X > |
Whether X is an Expected. More... | |
| struct | Sonde::Detail::IsExpected< Expected< T, E > > |
| An Expected is one. More... | |
| struct | Sonde::Detail::IsUnexpected< X > |
Whether X is an Unexpected. More... | |
| struct | Sonde::Detail::IsUnexpected< Unexpected< E > > |
| An Unexpected is one. More... | |
Namespaces | |
| namespace | Sonde |
| Embeddable Model Context Protocol server for Qt applications. | |
Enumerations | |
| enum class | Sonde::ErrorKind { Sonde::Failed , Sonde::NotHandled } |
| What kind of error an Error is. More... | |
Functions | |
| bool | Sonde::operator== (const Error &a, const Error &b) |
Whether a and b are the same error: the same kind and message. | |
| bool | Sonde::operator!= (const Error &a, const Error &b) |
Whether a and b are different errors. | |
| template<typename E> | |
| Sonde::Unexpected (E) -> Unexpected< E > | |
| Deduces the error type: Unexpected(Error{ ... }). | |
| Unexpected< Error > | Sonde::failure (QString message) |
A failure with message, to return as an Expected<T>. | |
| Unexpected< Error > | Sonde::notHandled () |
| "Not handled, ask the next integration", for GuiIntegration hooks to return. | |
| void | Sonde::Detail::badExpectedAccess (const char *what, const QString &problem) |
| Stops the program: value() or error() was asked of the wrong alternative. | |
| template<typename T, typename E, typename T2, typename E2> | |
| bool | Sonde::operator== (const Expected< T, E > &a, const Expected< T2, E2 > &b) |
Whether a and b hold equal values, or equal errors. | |
| template<typename T, typename E, typename T2, typename E2> | |
| bool | Sonde::operator!= (const Expected< T, E > &a, const Expected< T2, E2 > &b) |
Whether a and b differ. | |
| template<typename T, typename E, typename G> | |
| bool | Sonde::operator== (const Expected< T, E > &e, const Unexpected< G > &u) |
Whether e holds an error equal to u's. | |
| template<typename T, typename E, typename G> | |
| bool | Sonde::operator== (const Unexpected< G > &u, const Expected< T, E > &e) |
Whether e holds an error equal to u's. | |
| template<typename T, typename E, typename G> | |
| bool | Sonde::operator!= (const Expected< T, E > &e, const Unexpected< G > &u) |
Whether e doesn't hold an error equal to u's. | |
| template<typename T, typename E, typename G> | |
| bool | Sonde::operator!= (const Unexpected< G > &u, const Expected< T, E > &e) |
Whether e doesn't hold an error equal to u's. | |
| template<typename T, typename E, typename U, std::enable_if_t< Detail::isPlainValue< U > &&!std::is_void_v< T >, int > = 0> | |
| bool | Sonde::operator== (const Expected< T, E > &e, const U &value) |
Whether e holds a value equal to value. | |
| template<typename T, typename E, typename U, std::enable_if_t< Detail::isPlainValue< U > &&!std::is_void_v< T >, int > = 0> | |
| bool | Sonde::operator== (const U &value, const Expected< T, E > &e) |
Whether e holds a value equal to value. | |
| template<typename T, typename E, typename U, std::enable_if_t< Detail::isPlainValue< U > &&!std::is_void_v< T >, int > = 0> | |
| bool | Sonde::operator!= (const Expected< T, E > &e, const U &value) |
Whether e doesn't hold a value equal to value. | |
| template<typename T, typename E, typename U, std::enable_if_t< Detail::isPlainValue< U > &&!std::is_void_v< T >, int > = 0> | |
| bool | Sonde::operator!= (const U &value, const Expected< T, E > &e) |
Whether e doesn't hold a value equal to value. | |
Variables | |
| template<typename U> | |
| constexpr bool | Sonde::Detail::isPlainValue = !IsExpected<U>::value && !IsUnexpected<U>::value |
Whether U is a plain value to compare an Expected's value with: not an Expected or an Unexpected, which have comparisons of their own. | |
Sonde::Expected, Sonde::Unexpected and Sonde::Error: results that are a value or an error (design 0031).
C++17 has no std::expected, so Sonde has its own, with only the part of std::expected's interface that code is likely to use. Code written against it also compiles against std::expected, which a later major version of Sonde may make it an alias of:
| void Sonde::Detail::badExpectedAccess | ( | const char * | what, |
| const QString & | problem ) |
Stops the program: value() or error() was asked of the wrong alternative.
what is the function, problem what was wrong.