Status of operations.
More...
#include <tkrzw_lib_common.h>
|
enum | Code : int32_t {
SUCCESS = 0
, UNKNOWN_ERROR = 1
, SYSTEM_ERROR = 2
, NOT_IMPLEMENTED_ERROR = 3
,
PRECONDITION_ERROR = 4
, INVALID_ARGUMENT_ERROR = 5
, CANCELED_ERROR = 6
, NOT_FOUND_ERROR = 7
,
PERMISSION_ERROR = 8
, INFEASIBLE_ERROR = 9
, DUPLICATION_ERROR = 10
, BROKEN_DATA_ERROR = 11
,
APPLICATION_ERROR = 12
} |
| Enumeration of status codes. More...
|
|
◆ Code
Enumeration of status codes.
Enumerator |
---|
SUCCESS | Success.
|
UNKNOWN_ERROR | Generic error whose cause is unknown.
|
SYSTEM_ERROR | Generic error from underlying systems.
|
NOT_IMPLEMENTED_ERROR | Error that the feature is not implemented.
|
PRECONDITION_ERROR | Error that a precondition is not met.
|
INVALID_ARGUMENT_ERROR | Error that a given argument is invalid.
|
CANCELED_ERROR | Error that the operation is canceled.
|
NOT_FOUND_ERROR | Error that a specific resource is not found.
|
PERMISSION_ERROR | Error that the operation is not permitted.
|
INFEASIBLE_ERROR | Error that the operation is infeasible.
|
DUPLICATION_ERROR | Error that a specific resource is duplicated.
|
BROKEN_DATA_ERROR | Error that internal data are broken.
|
APPLICATION_ERROR | Generic error caused by the application logic.
|
◆ Status() [1/4]
tkrzw::Status::Status |
( |
| ) |
|
Default constructor representing the success code.
◆ Status() [2/4]
tkrzw::Status::Status |
( |
Code |
code, |
|
|
std::string_view |
message = "" |
|
) |
| |
Constructor representing a specific status.
- Parameters
-
code | The status code. |
message | An arbitrary status message. |
◆ Status() [3/4]
tkrzw::Status::Status |
( |
const Status & |
rhs | ) |
|
Copy constructor.
- Parameters
-
rhs | The right-hand-side object. |
◆ Status() [4/4]
tkrzw::Status::Status |
( |
Status && |
rhs | ) |
|
Move constructor.
- Parameters
-
rhs | The right-hand-side object. |
◆ operator=() [1/2]
Assigns the internal state from another status object.
- Parameters
-
◆ operator=() [2/2]
Assigns the internal state from another moved status object.
- Parameters
-
◆ operator|=()
Assigns the internal state from another status object only if the current state is success.
- Parameters
-
◆ GetCode()
Code tkrzw::Status::GetCode |
( |
| ) |
const |
Gets the status code.
- Returns
- The status code.
◆ GetMessage()
std::string tkrzw::Status::GetMessage |
( |
| ) |
const |
Gets the status message.
- Returns
- The status message.
◆ Set()
void tkrzw::Status::Set |
( |
Code |
code, |
|
|
std::string_view |
message = "" |
|
) |
| |
Sets the code and the message.
- Parameters
-
code | The status code. |
message | An arbitrary status message. |
◆ operator==() [1/2]
bool tkrzw::Status::operator== |
( |
const Status & |
rhs | ) |
const |
Checks whether the internal status code is equal to a given status.
- Parameters
-
rhs | The status to compare. |
- Returns
- True if the internal status code is equal to the given status.
◆ operator!=() [1/2]
bool tkrzw::Status::operator!= |
( |
const Status & |
rhs | ) |
const |
Checks whether the internal status code is not equal to a given status.
- Parameters
-
rhs | The status to compare. |
- Returns
- True if the internal status code is not equal to the given status.
◆ operator==() [2/2]
bool tkrzw::Status::operator== |
( |
const Code & |
code | ) |
const |
Checks whether the internal status code is equal to a given code.
- Parameters
-
- Returns
- True if the internal status code is equal to the given code.
◆ operator!=() [2/2]
bool tkrzw::Status::operator!= |
( |
const Code & |
code | ) |
const |
Checks whether the internal status code is not equal to a given code.
- Parameters
-
- Returns
- True if the internal status code is not equal to the given code.
◆ operator<()
bool tkrzw::Status::operator< |
( |
const Status & |
rhs | ) |
const |
Compares this object with another status object.
- Parameters
-
rhs | The status to compare. |
- Returns
- True if this object is considered less than the given object.
◆ operator std::string()
tkrzw::Status::operator std::string |
( |
| ) |
const |
Gets a string expression of the status.
- Returns
- The string expression
◆ IsOK()
bool tkrzw::Status::IsOK |
( |
| ) |
const |
Returns true if the status is success.
- Returns
- True if the status is success, or false on failure.
◆ OrDie()
const Status& tkrzw::Status::OrDie |
( |
| ) |
const |
Throws an exception if the status is not success.
- Returns
- The reference to this object.
◆ CodeName()
static const char* tkrzw::Status::CodeName |
( |
Code |
code | ) |
|
|
static |
Gets the string name of a status code.
- Parameters
-
- Returns
- The name of the status code.