Status_t Class Reference

Class which encompasses a success or failure status across all error code value spaces. More...

#include <UTStatus.h>

List of all members.

Public Member Functions

 Status_t ()
 Status_t (error_code_t error_code)
 Status_t (error_code_t error_code, const utf8 *explanation)
 Status_t (error_code_t error_code, stringliteral *explanation)
 Status_t (error_code_t error_code, const String_t &explanation)
 Status_t (const Status_t &copy)
 Status_t (const Status_t &copy, const utf8 *explanation)
 Status_t (const Status_t &copy, stringliteral *explanation)
 Status_t (const Status_t &copy, const String_t &explanation)
 ~Status_t ()
const Status_toperator= (const Status_t &set)
const Status_toperator= (error_code_t set)
error_code_t StatusCode () const
bool Success () const
bool SuccessAndTrue () const
bool SuccessAndFalse () const
const String_tExplanation () const
bool operator== (const Status_t &other) const
bool operator== (error_code_t error_code) const
bool operator!= (const Status_t &other)
bool operator!= (error_code_t error_code)
bool operator< (int32 value)
bool operator<= (int32 value)
bool operator> (int32 value)
bool operator>= (int32 value)

Static Public Member Functions

static Status_t POSIXError (int posix_error_code)
static Status_t POSIXError (int posix_error_code, const utf8 *extra_explanation)
static Status_t POSIXError (int posix_error_code, stringliteral *extra_explanation)

Detailed Description

Class which encompasses a success or failure status, with zero or positive values indicating success, and negative values indicating failure. The class also allows extra explanatory text to be attached to the status object and passed to or returned from functions by value with very high efficiency. In failure cases, the Status_t class facilitates an integrated value space encompassing system error codes, POSIX error codes, UT library error codes, and user-defined error codes. The contents of a Status_t, including the textual meaning of an error and attached explanatory text, can be rendered into a String_t object using the String_t::Printf function or any debug_printf variant with the "%S" format (a nonstandard but reasonable extension to the normal C standard format strings). When using the "%S" format, a pointer to the Status_t should be passed in the varargs list.

Definition at line 82 of file UTStatus.h.


Constructor & Destructor Documentation

Status_t::Status_t (  )  [inline]

Default constructor, which initializes itself to a generic success status.

Definition at line 460 of file UTStatus.h.

Status_t::Status_t ( error_code_t  error_code  )  [inline]

Constructor which initializes itself to the specified state.
if error_code >= 0, indicates success, with the value optionally being considered an integer or boolean
if error_code < 0, indicates failure with system errors, UT internal errors, POSIX errors, or user-defined errors in a single integrated value space.

Definition at line 468 of file UTStatus.h.

Status_t::Status_t ( error_code_t  error_code,
const utf8 explanation 
) [inline]

Constructor which initializes itself to the specified state and attaches the specified explanatory text. The explanatory String_t copies a UTF8 string fully independent of the original; const string pointers are not borrowed, therefore a copied string becomes fully autonomous. Status_t with an explanation is thread safe, using atomic addition for managing the reference count.
if error_code >= 0, indicates success, with the value optionally being considered an integer or boolean
if error_code < 0, indicates failure with system errors, UT internal errors, POSIX errors, or user-defined errors in a single integrated value space.

Definition at line 476 of file UTStatus.h.

Status_t::Status_t ( error_code_t  error_code,
stringliteral explanation 
) [inline]

Constructor which initializes itself to the specified state and attaches the specified explanatory text. The explanatory String_t persistently references the string literal; the pointer is borrowed. Therefore the Status_t object and its explanatory text, including copies of it and copies returned by value are dependent on the pointer with which it was constructed. The contents of that pointer must remain valid for the life of the Status_t object and all copies. Status_t with an explanation is thread safe, using atomic addition for managing the reference count.
if error_code >= 0, indicates success, with the value optionally being considered an integer or boolean
if error_code < 0, indicates failure with system errors, UT internal errors, POSIX errors, or user-defined errors in a single integrated value space.

Definition at line 485 of file UTStatus.h.

Status_t::Status_t ( error_code_t  error_code,
const String_t explanation 
)

Constructor which initializes itself to the specified state and attaches the specified explanatory text. The explanatory String_t copies a string fully independent of the original; const string pointers are not borrowed, therefore a copied string becomes fully autonomous. Status_t with an explanation is thread safe, using atomic addition for managing the reference count.
if error_code >= 0, indicates success, with the value optionally being considered an integer or boolean
if error_code < 0, indicates failure with system errors, UT internal errors, POSIX errors, or user-defined errors in a single integrated value space.

Status_t::Status_t ( const Status_t copy  )  [inline]

Copy constructor. If the Status_t being copied includes explanatory text, a reference will be added to that explanatory text RefCountedString_t object.

Definition at line 494 of file UTStatus.h.

Status_t::Status_t ( const Status_t copy,
const utf8 explanation 
)

Copy constructor which adds explanation, possibly prepending the explanation to an existing explanation in the copied status. The explanatory String_t copies a UTF8 string fully independent of the original; const string pointers are not borrowed, therefore a copied string becomes fully autonomous. Status_t with an explanation is safe, using atomic addition for managing the reference count.

Status_t::Status_t ( const Status_t copy,
stringliteral explanation 
)

Copy constructor which adds explanation, possibly prepending the explanation to an existing explanation in the copied status. The explanatory String_t may persistently reference the string literal; the pointer is borrowed. Therefore the Status_t object and its explanatory text, including copies of it and copies returned by value are dependent on the pointer with which it was constructed. The contents of that pointer must remain valid for the life of the Status_t object and all copies. Status_t with an explanation is thread safe, using atomic addition for managing the reference count.

Status_t::Status_t ( const Status_t copy,
const String_t explanation 
)

Copy constructor which adds explanation, possibly prepending the explanation to an existing explanation in the copied status. The explanatory String_t copies a string fully independent of the original; const string pointers are not borrowed, therefore a copied string becomes fully autonomous. Status_t with an explanation is thread safe, using atomic addition for managing the reference count.

Status_t::~Status_t (  )  [inline]

Destructor. If the Status_t includes explanatory text, a reference will be removed from the explanatory text RefCountedString_t object such that when the last copy of this Status_t is deleted, the explanatory text will be deleted with it.

Definition at line 504 of file UTStatus.h.


Member Function Documentation

const Status_t & Status_t::operator= ( const Status_t set  )  [inline]

Assignment operator. If the Status_t being copied includes explanatory text, a reference will be added to that explanatory text RefCountedString_t object. If the Status_t being assigned previously included explanatory text, a reference will be removed from the prior explanatory text RefCountedString_t object such that if this was the last reference to the previous contents, the old explanatory text will be deleted.

Definition at line 512 of file UTStatus.h.

const Status_t & Status_t::operator= ( error_code_t  set  )  [inline]

Assignment operator. Explanation will become NULL. If the Status_t being assigned previously included explanatory text, a reference will be removed from the prior explanatory text RefCountedString_t object such that if this was the last reference to the previous contents, the old explanatory text will be deleted.

Definition at line 524 of file UTStatus.h.

error_code_t Status_t::StatusCode (  )  const [inline]

Returns the result value, which can be success or failure. Success values are >= 0. Error values are < 0. Boolean values in a success case are true or false.

Definition at line 555 of file UTStatus.h.

bool Status_t::Success (  )  const [inline]

Returns true or false indicating whether the error_code_t representing the fundamental status indicates success or failure. Error status codes are negative values.

Definition at line 534 of file UTStatus.h.

bool Status_t::SuccessAndTrue (  )  const [inline]

Returns true or false indicating whether the error_code_t representing the fundamental status indicates success and a boolean result of true.

Definition at line 541 of file UTStatus.h.

bool Status_t::SuccessAndFalse (  )  const [inline]

Returns true or false indicating whether the error_code_t representing the fundamental status indicates success and a boolean result of false.

Definition at line 548 of file UTStatus.h.

const String_t* Status_t::Explanation (  )  const

Returns the explanatory text if any exists, otherwise NULL.

bool Status_t::operator== ( const Status_t other  )  const

Evaluates whether this Status_t is equivalent to another. Only the value of the error_code_t which holds the fundamental status is considered; the absence or contents if present of any explanatory text is not considered.

bool Status_t::operator== ( error_code_t  error_code  )  const [inline]

Evaluates whether the value of the error_code_t which holds the fundamental status equals the one being compared against.

Definition at line 562 of file UTStatus.h.

bool Status_t::operator!= ( const Status_t other  )  [inline]

Evaluates whether this Status_t is not equivalent to another. Only the value of the error_code_t which holds the fundamental status is considered; the absence or contents if present of any explanatory text is not considered.

Definition at line 569 of file UTStatus.h.

bool Status_t::operator!= ( error_code_t  error_code  )  [inline]

Evaluates whether the value of the error_code_t which holds the fundamental status is not equal to the one being compared against.

Definition at line 576 of file UTStatus.h.

bool Status_t::operator< ( int32  value  )  [inline]

Evaluates whether the value of the error_code_t which holds the fundamental status is less than the specified integer.

Definition at line 583 of file UTStatus.h.

bool Status_t::operator<= ( int32  value  )  [inline]

Evaluates whether the value of the error_code_t which holds the fundamental status is less than or equal to the specified integer.

Definition at line 590 of file UTStatus.h.

bool Status_t::operator> ( int32  value  )  [inline]

Evaluates whether the value of the error_code_t which holds the fundamental status is greater than the specified integer.

Definition at line 597 of file UTStatus.h.

bool Status_t::operator>= ( int32  value  )  [inline]

Evaluates whether the value of the error_code_t which holds the fundamental status is greater than or equal to the specified integer.

Definition at line 604 of file UTStatus.h.

Status_t Status_t::POSIXError ( int  posix_error_code  )  [inline, static]

Constructs a Status_t for a POSIX error code as obtained from errno and as defined in errno.h.

Definition at line 653 of file UTStatus.h.

Status_t Status_t::POSIXError ( int  posix_error_code,
const utf8 extra_explanation 
) [inline, static]

Constructs a Status_t for a POSIX error code as obtained from errno and as defined in errno.h and attaches the specified explanatory text. The explanatory String_t copies a UTF8 string fully independent of the original const string pointers are not borrowed, therefore a copied string becomes fully autonomous. Status_t with an explanation is thread safe, using atomic addition for managing the reference count.

Definition at line 661 of file UTStatus.h.

Status_t Status_t::POSIXError ( int  posix_error_code,
stringliteral extra_explanation 
) [inline, static]

Constructs a Status_t for a POSIX error code as obtained from errno and as defined in errno.h and attaches the specified explanatory text. The explanatory String_t persistently references the string literal; the pointer is borrowed. Therefore the Status_t object and its explanatory text, including copies of it and copies returned by value are dependent on the pointer with which it was constructed. The contents of that pointer must remain valid for the life of the Status_t object and all copies. Status_t with an explanation is thread safe, using atomic addition for managing the reference count.

Definition at line 668 of file UTStatus.h.


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

Generated on Tue Dec 14 22:35:07 2010 for UT library by  doxygen 1.6.1