Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SError Class Reference

Standard/System error class. More...

#include <serror.h>

Collaboration diagram for SError:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SError ()
 Default constructor: success.

 SError (const SError &e)
 Copy constructor.

 SError (GError *&g)
 SError (const char *str, int _code, int _domain=-1)
 Set an error specifying a string, a code and a domain.

 SError (const TLString &str, int _code, int _domain=-1)
 Set an error specifying a string, a code and a domain.

 ~SError ()
 Destructor.

SErroroperator= (GError *&g)
SErroroperator= (const SError &e)
 Assignment operator.

 operator bool () const
 Check for error. Retuens 1 on error and 0 on success.

bool operator! () const
 Check for error. Returns 1 on success and 0 on error.

void clear ()
 Clear error (change it into "success").

const TLStringmsg () const
 Get the error message:.

void AppendMsg (const TLString &str)
 Append to the error message; will separate parts by ";".

void AppendMsg (const char *str)
 Append to the error message; will separate parts by ";".

int code () const
 Get the error code.


Private Member Functions

void _assign (GError *&g)

Private Attributes

TLString errmsg
 string representation of error

int ecode
 Numerical error code; 0 -> success, <0 -> warning.

int edomain
 Error domain for code; -1 -> unset.


Detailed Description

Standard/System error class.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This class represents a standard/system error like failure to open " a file, and not a porgramming error (use some assertion therefore).

The class contains a string representation of the error to be easily displayed to the user.

A numerical representation of the error is provided with the code and domain variables. The code is the numerical error code inside the error domain. For example, two error domains could be 0 for "file error" and 1 for "network error" and the numerical error codes can be chosen idependently in both domains (e.g. code 1 in domain 0 may mean "file does not exist" while code 1 in domain 1 may mean "connection refused").

The code using this library is responsible for understanding the domain and code values; they are not altered by the SError class.

Definition at line 54 of file serror.h.


Constructor & Destructor Documentation

SError::SError  )  [inline]
 

Default constructor: success.

Definition at line 64 of file serror.h.

References ecode, edomain, and errmsg.

SError::SError const SError e  )  [inline]
 

Copy constructor.

Definition at line 66 of file serror.h.

References ecode, edomain, and errmsg.

SError::SError GError *&  g  )  [inline]
 

Assign a GError from GLib. This will destroy the GError setting the passed pointer to NULL.

Definition at line 70 of file serror.h.

References _assign(), ecode, edomain, and errmsg.

SError::SError const char *  str,
int  _code,
int  _domain = -1
[inline]
 

Set an error specifying a string, a code and a domain.

Definition at line 73 of file serror.h.

References ecode, edomain, and errmsg.

SError::SError const TLString str,
int  _code,
int  _domain = -1
[inline]
 

Set an error specifying a string, a code and a domain.

Definition at line 76 of file serror.h.

References ecode, edomain, and errmsg.

SError::~SError  )  [inline]
 

Destructor.

Definition at line 79 of file serror.h.


Member Function Documentation

void SError::_assign GError *&  g  )  [private]
 

Definition at line 21 of file serror_g.cc.

References ecode, edomain, and errmsg.

Referenced by operator=(), and SError().

void SError::AppendMsg const char *  str  ) 
 

Append to the error message; will separate parts by ";".

Definition at line 29 of file serror.cc.

References errmsg.

void SError::AppendMsg const TLString str  ) 
 

Append to the error message; will separate parts by ";".

Definition at line 21 of file serror.cc.

References errmsg.

Referenced by ParseFloatSpec().

void SError::clear  )  [inline]
 

Clear error (change it into "success").

Definition at line 97 of file serror.h.

References ecode, edomain, and errmsg.

Referenced by _ParseInt(), _ParseUInt(), and TLString::ParseString().

int SError::code  )  const [inline]
 

Get the error code.

Definition at line 110 of file serror.h.

References ecode.

const TLString& SError::msg  )  const [inline]
 

Get the error message:.

Definition at line 101 of file serror.h.

References errmsg.

Referenced by _DoParseFile(), _ParseInt(), _ParseUInt(), and main().

SError::operator bool  )  const [inline]
 

Check for error. Retuens 1 on error and 0 on success.

Definition at line 90 of file serror.h.

References ecode.

bool SError::operator!  )  const [inline]
 

Check for error. Returns 1 on success and 0 on error.

Definition at line 93 of file serror.h.

References ecode.

SError& SError::operator= const SError e  )  [inline]
 

Assignment operator.

Definition at line 86 of file serror.h.

References ecode, edomain, and errmsg.

SError& SError::operator= GError *&  g  )  [inline]
 

Assign a GError from GLib. This will destroy the GError setting the passed pointer to NULL.

Definition at line 83 of file serror.h.

References _assign().


Member Data Documentation

int SError::ecode [private]
 

Numerical error code; 0 -> success, <0 -> warning.

Definition at line 58 of file serror.h.

Referenced by _assign(), clear(), code(), operator bool(), operator!(), operator=(), and SError().

int SError::edomain [private]
 

Error domain for code; -1 -> unset.

Definition at line 59 of file serror.h.

Referenced by _assign(), clear(), operator=(), and SError().

TLString SError::errmsg [private]
 

string representation of error

Definition at line 57 of file serror.h.

Referenced by _assign(), AppendMsg(), clear(), msg(), operator=(), and SError().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:35:38 2005 for Ray by doxygen 1.3.5