#include <result_type_decl.h>
|
| | Result () |
| |
| | Result (bool val) |
| |
| | Result (const ResultInfo< void > &) |
| |
| template<typename ErrorType> |
| | Result (const ResultInfo< ErrorType > &error) |
| |
| template<typename ErrorType> |
| | Result (ResultInfo< ErrorType > error, const char *error_description, std::int32_t line, const char *file, const char *function) |
| |
| | Result (std::int32_t error_code) |
| |
| | Result (std::int32_t error_code, const char *error_description, std::int32_t line, const char *file, const char *function) |
| |
| | Result (const Result &other_result, const char *error_description, std::int32_t line, const char *file, const char *function) |
| |
| | ~Result () |
| |
| | Result (const Result &other) |
| |
| Result & | operator= (const ResultInfo< void > &) |
| |
| Result & | operator= (Result other) |
| |
| Result & | operator= (bool val) |
| |
| Result & | operator= (std::int32_t val) |
| |
| | Result (Result &&other) |
| |
| std::int32_t | getErrorCode () const |
| |
| const char * | getErrorLabel () const |
| |
| const char * | getDescription () const |
| |
| std::int32_t | getLine () const |
| |
| const char * | getFile () const |
| |
| const char * | getFunction () const |
| |
| | operator bool () const noexcept |
| |
A common result class usable as return value throughout.
◆ Result() [1/10]
| a_util::result::Result::Result |
( |
| ) |
|
|
inline |
◆ Result() [2/10]
| a_util::result::Result::Result |
( |
bool | val | ) |
|
|
inline |
◆ Result() [3/10]
| a_util::result::Result::Result |
( |
const ResultInfo< void > & | | ) |
|
|
inline |
Construct with a_util::result::SUCCESS
This constructors sole intention is to provide the best match during compilation time if a function call returns with a_util::result::SUCCESS. With decltype(a_util::result::SUCCESS) being another type than all other error codes the compiler deduces this constructor as best fit.
- Postcondition
- See also
- Result()
◆ Result() [4/10]
template<typename ErrorType>
| a_util::result::Result::Result |
( |
const ResultInfo< ErrorType > & | error | ) |
|
|
inline |
Assign error code to result object
- Parameters
-
◆ Result() [5/10]
template<typename ErrorType>
| a_util::result::Result::Result |
( |
ResultInfo< ErrorType > | error, |
|
|
const char * | error_description, |
|
|
std::int32_t | line, |
|
|
const char * | file, |
|
|
const char * | function ) |
|
inlineexplicit |
Construct result object with complete set of error information
- Template Parameters
-
| ErrorCode | Error code (to deduce specialized template to stringify the error code) |
- Parameters
-
| [in] | error | The The concrete error object |
| [in] | error_description | Complete description of the error (default: "") |
| [in] | line | Line in source file the error was reported (default: -1) |
| [in] | file | Source file the error was reported in (default: "") |
| [in] | function | Function the error was reported in (default: "") |
◆ Result() [6/10]
| a_util::result::Result::Result |
( |
std::int32_t | error_code | ) |
|
|
inline |
Create result object with just the error code type.
- Parameters
-
| [in] | error_code | The error code |
◆ Result() [7/10]
| a_util::result::Result::Result |
( |
std::int32_t | error_code, |
|
|
const char * | error_description, |
|
|
std::int32_t | line, |
|
|
const char * | file, |
|
|
const char * | function ) |
|
inlineexplicit |
Create result object with complete set of error information from just an error code
- Parameters
-
| [in] | error_code | The error code |
| [in] | error_description | Complete description of the error (default: "") |
| [in] | line | Line in source file the error was reported (default: -1) |
| [in] | file | Source file the error was reported in (default: "") |
| [in] | function | Function the error was reported in (default: "") |
◆ Result() [8/10]
| a_util::result::Result::Result |
( |
const Result & | other_result, |
|
|
const char * | error_description, |
|
|
std::int32_t | line, |
|
|
const char * | file, |
|
|
const char * | function ) |
|
inlineexplicit |
Create result object from another result, creating new detailed information
- Parameters
-
| [in] | other_result | Result to copy the error code and error code string information from. |
| [in] | error_description | Complete description of the error. |
| [in] | line | Line in source file the error was reported. |
| [in] | file | Source file the error was reported in. |
| [in] | function | Function the error was reported in. |
◆ ~Result()
| a_util::result::Result::~Result |
( |
| ) |
|
|
inline |
◆ Result() [9/10]
| a_util::result::Result::Result |
( |
const Result & | other | ) |
|
|
inline |
Copy constructor.
- Parameters
-
| [in] | other | Where this gets copied from. |
- Note
- No new memory is allocated, the error information from
other are safely referenced in the new created object of type Result.
◆ Result() [10/10]
| a_util::result::Result::Result |
( |
Result && | other | ) |
|
|
inline |
Move operator.
- Parameters
-
| [in] | other | rvalue of type Result moved to *this. Left in an empty but valid state. |
◆ getDescription()
| const char * a_util::result::Result::getDescription |
( |
| ) |
const |
|
inline |
Get user provided error description.
- Returns
- Error description as string.
◆ getErrorCode()
| std::int32_t a_util::result::Result::getErrorCode |
( |
| ) |
const |
|
inline |
Get error code.
- Returns
- Error code.
◆ getErrorLabel()
| const char * a_util::result::Result::getErrorLabel |
( |
| ) |
const |
|
inline |
Get error label as string representation.
- Returns
- Error code represented as string.
◆ getFile()
| const char * a_util::result::Result::getFile |
( |
| ) |
const |
|
inline |
Get name of the file the error was reported in.
- Returns
- File name as string.
◆ getFunction()
| const char * a_util::result::Result::getFunction |
( |
| ) |
const |
|
inline |
Get name of the function the error was reported in.
- Returns
- Function name as string.
◆ getLine()
| std::int32_t a_util::result::Result::getLine |
( |
| ) |
const |
|
inline |
Get line in source file where the error was reported.
- Returns
- Line number.
◆ operator bool()
| a_util::result::Result::operator bool |
( |
| ) |
const |
|
inlineexplicitnoexcept |
Convert result to bool
- Returns
- If error code equals 0,
true, otherwise false
◆ operator=() [1/4]
| Result & a_util::result::Result::operator= |
( |
bool | val | ) |
|
|
inline |
Assignment from bool
- Parameters
-
| [in] | val | Bool value to construct with |
- Postcondition
- No dynamic memory is allocated.
- Returns
- Reference to *this
◆ operator=() [2/4]
Assign with a_util::result::SUCCESS
This assignments sole intention is to provide the best match during compilation time if a function call returns with a_util::result::SUCCESS. With decltype(a_util::result::SUCCESS) being another type than all other error codes the compiler deduces this assignment operator as best fit.
- Postcondition
- See also
- Result()
- Returns
- *this
◆ operator=() [3/4]
Assignment operator
- Parameters
-
| [in] | other | Result type being assigned to the this object. |
- Note
- Passing
other by value is fully intentional here!
- Returns
- *this
◆ operator=() [4/4]
| Result & a_util::result::Result::operator= |
( |
std::int32_t | val | ) |
|
|
inline |
Assignment from numeric
- Parameters
-
| [in] | val | Numeric value to construct with |
- Postcondition
- No dynamic memory is allocated.
- Returns
- Reference to *this
◆ operator==
Comparison operator (shallow comparison)
- Parameters
-
| [in,out] | lhs | Left hand side result object. |
| [in,out] | rhs | Right hand side result object. |
- Returns
true if both result objects match, false otherwise.
◆ swap
Specialized friend swap function to enable ADL in std::swap later.
- Parameters
-
| [in,out] | lhs | Left hand side result object. |
| [in,out] | rhs | Right hand side result object. |
The documentation for this class was generated from the following files: