An ascii string used as boolean result. SC_TRY macro forwards errors to caller.
More...
#include <Result.h>
|
template<int numChars> |
static constexpr Result | Error (const char(&msg)[numChars]) |
| Constructs an Error from a pointer to an ASCII string literal. More...
|
|
static constexpr Result | FromStableCharPointer (const char *msg) |
| Constructs an Error from a pointer to an ascii string. More...
|
|
|
const char * | message |
| If == nullptr then Result is valid. If != nullptr it's the reason of the error. More...
|
|
An ascii string used as boolean result. SC_TRY macro forwards errors to caller.
◆ Result()
constexpr SC::Result::Result |
( |
bool |
result | ) |
|
|
inlineexplicitconstexpr |
Build a Result object from a boolean.
- Parameters
-
result | Passing true constructs a valid Result. Passing false constructs invalid Result. |
◆ Error()
template<int numChars>
static constexpr Result SC::Result::Error |
( |
const char(&) |
msg[numChars] | ) |
|
|
inlinestaticconstexpr |
Constructs an Error from a pointer to an ASCII string literal.
- Template Parameters
-
numChars | Size of the character array holding the ASCII string |
- Parameters
-
msg | The custom error message |
- Returns
- A Result object in invalid state
◆ FromStableCharPointer()
static constexpr Result SC::Result::FromStableCharPointer |
( |
const char * |
msg | ) |
|
|
inlinestaticconstexpr |
Constructs an Error from a pointer to an ascii string.
Caller of this function must ensure such pointer to be valid until Result is used.
- Parameters
-
msg | Pointer to ASCII string representing the message. |
- Returns
- A Result object in invalid state
◆ operator bool()
constexpr SC::Result::operator bool |
( |
| ) |
const |
|
inlineconstexpr |
Converts to true
if the Result is valid, to false
if it's invalid.
◆ message
const char* SC::Result::message |
If == nullptr then Result is valid. If != nullptr it's the reason of the error.
The documentation for this struct was generated from the following file: