fab  130
API Documentation
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
Failable Class Reference

base class for something that does have a failed/good state. More...

#include <failable.hxx>

Inheritance diagram for Failable:
Failables RioLocalTaskInitializer

Public Member Functions

bool isGood () const
 fine
 
int print (char *sz, unsigned size) const
 
int iErr ()
 error code
 
const char * szErr ()
 error text
 
bool isFail () const
 last op failed, but object is uncorrupted
 
bool isBad () const
 last op failed, object is corrupted
 
bool operator! () const
 true if failed More...
 
 operator const void * () const
 zero if failed More...
 
FailablesetFailed (const char *sz, int i=0)
 set 'this' failed, record a string and an integer for failure identification More...
 
FailablesetBad (const char *sz, int i=0)
 set this bad, record a string and an integer for failure identification
 
Failableclear ()
 user clear of failed/bad state
 
 Failable (const char *sz, int i)
 

Protected Types

enum  StatE { E_OK, E_FAIL = 001, E_BAD = 002, E_NEXT = 004 }
 

Protected Member Functions

FailablesetStat (StatE eStat, const char *sz, int i)
 
FailablesetStat (const Failable &fa)
 
bool entry ()
 resets the failed state. More...
 

Protected Attributes

enum Failable::StatE _eStat
 

Friends

std::ostream & operator<< (std::ostream &, const Failable &)
 

Detailed Description

base class for something that does have a failed/good state.

Member Function Documentation

◆ entry()

bool entry ( )
protected

resets the failed state.

returns !good

◆ operator const void *()

operator const void * ( ) const
inline

zero if failed

if (fa) do_good();

References isFail().

◆ operator!()

bool operator! ( ) const
inline

true if failed

if (!fa) do_failed();

References isFail().

◆ setFailed()

Failable& setFailed ( const char *  sz,
int  i = 0 
)
inline

set 'this' failed, record a string and an integer for failure identification

if (i==-1) fa.setFailed(__FILE__, __LINE__);

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