ErrUt  1.1.0 (development version)
Public Member Functions | List of all members
errut::bool_t Class Reference

Type to return true/false with error description. More...

#include <booltype.h>

Public Member Functions

 bool_t (bool f=true)
 Just set true or false, but leave the error description undefined in case of 'false'. More...
 
 bool_t (const char *pStr)
 Set the return value to 'false', and the error string to the specified value. More...
 
 bool_t (const std::string &err)
 Set the return value to 'false', and the error string to the specified value. More...
 
 bool_t (const bool_t &b)
 Copy constructor. More...
 
bool_toperator= (const bool_t &b)
 Assignment operator. More...
 
std::string getErrorString () const
 Returns a description of the error. More...
 
 operator bool () const
 Returns true or false, depending on the contents of this object. More...
 
bool success () const
 Returns true or false, depending on the contents of this object. More...
 

Detailed Description

This type is intended to be used as a return value of functions, which return true on success and false on failure. Additionally, when an error is returned, an error description can be set. The error description can be retrieved using the bool_t::getErrorString member function.

To make it easier to use, you can just return an error description, in which case the boolean value of the type will automatically be 'false'.

Constructor & Destructor Documentation

◆ bool_t() [1/4]

errut::bool_t::bool_t ( bool  f = true)
inline

◆ bool_t() [2/4]

errut::bool_t::bool_t ( const char *  pStr)
inline

◆ bool_t() [3/4]

errut::bool_t::bool_t ( const std::string &  err)
inline

◆ bool_t() [4/4]

errut::bool_t::bool_t ( const bool_t b)
inline

Member Function Documentation

◆ getErrorString()

std::string errut::bool_t::getErrorString ( ) const
inline

◆ operator bool()

errut::bool_t::operator bool ( ) const
inline

◆ operator=()

bool_t & errut::bool_t::operator= ( const bool_t b)
inline

◆ success()

bool errut::bool_t::success ( ) const
inline

The documentation for this class was generated from the following file: