|
| checked () |
|
| checked (const T &obj_, const erc &err) |
| Constructor using a T and an error code. Both are copy-constructed.
|
|
| checked (const T &obj_, int value=0, erc::level pri_=erc::level::error) |
|
| checked (T &&obj_, erc &&err) |
|
| checked (T &&obj_, const erc &err) |
|
| checked (const checked< T > &other) |
| Copy constructor.
|
|
| checked (checked< T > &&other) |
| Move constructor.
|
|
checked< T > & | operator= (const checked< T > &rhs) |
| Assignment operator.
|
|
checked< T > & | operator= (checked< T > &&rhs) |
| Move assignment operator.
|
|
checked< T > & | operator= (const erc &rhs) |
| Set error value.
|
|
|
T & | operator* () |
|
const T & | operator* () const |
|
T * | operator-> () |
|
const T * | operator-> () const |
|
| erc () |
| Default ctor for erc objects creates an inactive error.
|
|
| erc (int value, level priority=level::error) |
| Ctor for a real erc using default error facility.
|
|
| erc (int value, const mlib::errfac &facility, level priority=level::error) |
| Ctor for a real erc.
|
|
| erc (const erc &other) |
| Copy constructor removes the activity flag of the original object.
|
|
| erc (erc &&other) |
| Move constructor removes the activity flag of the original object.
|
|
| ~erc () noexcept(false) |
| Destructor. Call raise() function to see if the error should get logged or thrown.
|
|
erc & | operator= (const erc &rhs) |
| Principal assignment operator.
|
|
erc & | operator= (erc &&rhs) |
| Move assignment operator.
|
|
| operator int () const |
| Integer conversion operator.
|
|
level | priority () const |
| Return priority value.
|
|
bool | is_active () const |
| Return activity flag.
|
|
const errfac & | facility () const |
| Return reference to facility.
|
|
bool | operator== (const erc &other) const |
| Equality comparison operator.
|
|
bool | operator!= (const erc &other) const |
| Inequality comparison operator.
|
|
void | raise () const |
|
void | reactivate () const |
| Similar to re-throwing an exception.
|
|
void | deactivate () const |
| Marks error code as inactive.
|
|
int | code () const |
| Return numerical value.
|
|
std::string | message () const |
| Get logging message.
|
|
void | message (const std::string &m) |
| Set the message for this error.
|
|
template<checkable T>
class mlib::checked< T >
Provides a mechanism similar to expected for creating objects associated with error codes.
checked<T>
objects are derived from mlib::erc
, so they can be treated as regular erc
objects, in particular they can be compared with an integer to check if they contain an error. To access the included T
object, use the '->' or '*' operators.
- Note
- To avoid conflicts with the erc integer conversion operator, the template argument T should NOT be convertible to
int
.
- Template Parameters
-
T | - the type of the included object |