Standarized error.
More...
#include <cutehmi/Error.hpp>
Standarized error.
Class reserves negative values for its error codes. When subclassing start custom error codes from 1 (Error::SUBCLASS_BEGIN
).
◆ anonymous enum
Enumerator |
---|
UNINITIALIZED | |
FAIL | |
OK | |
SUBCLASS_BEGIN | |
◆ Error() [1/2]
cutehmi::Error::Error |
( |
| ) |
|
◆ Error() [2/2]
cutehmi::Error::Error |
( |
int |
code | ) |
|
Conversion constructor.
- Parameters
-
◆ code()
int cutehmi::Error::code |
( |
| ) |
const |
Get error code.
- Returns
- error code.
◆ operator bool()
cutehmi::Error::operator bool |
( |
| ) |
const |
Conversion to bool
.
Evaluates to true
if error code is Error::OK
, false
otherwise.
◆ operator!=()
bool cutehmi::Error::operator!= |
( |
const Error & |
other | ) |
const |
◆ operator==()
bool cutehmi::Error::operator== |
( |
const Error & |
other | ) |
const |
◆ setCode()
void cutehmi::Error::setCode |
( |
int |
code | ) |
|
|
protected |
◆ str()
QString cutehmi::Error::str |
( |
| ) |
const |
Get error string.
A subclass may reimplement this method to provide its own error descriptions.
- Returns
- error message.
- Note
- This function is non-virtual. When calling this function on down-casted instance of derived class, it may not recognize error code and return generic message.