IOStatus represents the result of an operation.
More...
#include <io.h>
IOStatus represents the result of an operation.
Consists of an error code and additional information in a string message. The error code may be a value from mio::StatusCode or from a dependency. The category of the error code can be inspected to see where the error code originated; see https://en.cppreference.com/w/cpp/error/error_code.
◆ IOStatus() [1/2]
| mio::IOStatus::IOStatus |
( |
| ) |
|
|
default |
default constructor, represents success
◆ IOStatus() [2/2]
| mio::IOStatus::IOStatus |
( |
std::error_code |
ec, |
|
|
std::string |
msg = {} |
|
) |
| |
|
inline |
constructor with error code and message
- Parameters
-
| ec | error code |
| msg | optional message with additional information about the error, default empty. |
◆ code()
| const std::error_code& mio::IOStatus::code |
( |
| ) |
const |
|
inline |
◆ formatted_message()
| std::string mio::IOStatus::formatted_message |
( |
| ) |
const |
|
inline |
Get a string that combines the error code and the message.
◆ is_error()
| bool mio::IOStatus::is_error |
( |
| ) |
const |
|
inline |
Check if the status represents failure.
- Returns
- true if status is failure, false otherwise.
◆ is_ok()
| bool mio::IOStatus::is_ok |
( |
| ) |
const |
|
inline |
Check if the status represents success.
is_ok() is Equivalent to !bool(code()).
- Returns
- true if status is success, false otherwise.
◆ message()
| const std::string& mio::IOStatus::message |
( |
| ) |
const |
|
inline |
get the message that contains additional information about errors.
◆ operator bool()
| mio::IOStatus::operator bool |
( |
| ) |
const |
|
inline |
Check if the status represents success.
is_ok() is Equivalent to !bool(code()).
- Returns
- true if status is success, false otherwise.
◆ operator!=()
| bool mio::IOStatus::operator!= |
( |
const IOStatus & |
other | ) |
const |
|
inline |
equality comparison operators.
◆ operator==()
| bool mio::IOStatus::operator== |
( |
const IOStatus & |
other | ) |
const |
|
inline |
equality comparison operators.
◆ m_ec
| std::error_code mio::IOStatus::m_ec = {} |
|
private |
Check if the status represents failure.
- Returns
- true if status is failure, false otherwise.
◆ m_msg
| std::string mio::IOStatus::m_msg = {} |
|
private |
Check if the status represents failure.
- Returns
- true if status is failure, false otherwise.