kviewshell
GException Class Reference
Exception class. More...
#include <GException.h>
Public Types | |
enum | source_type { GINTERNAL = 0, GEXTERNAL, GAPPLICATION, GOTHER } |
Public Member Functions | |
int | cmp_cause (const char s2[]) const |
const char * | get_cause (void) const |
const char * | get_file (void) const |
const char * | get_function (void) const |
int | get_line (void) const |
source_type | get_source (void) const |
GException () | |
GException (const GException &exc) | |
GException (const char *cause, const char *file=0, int line=0, const char *func=0, const source_type source=GINTERNAL) | |
GException & | operator= (const GException &exc) |
void | perror (void) const |
virtual | ~GException (void) |
Static Public Member Functions | |
static int | cmp_cause (const char s1[], const char s2[]) |
Static Public Attributes | |
static const char *const | outofmemory = ERR_MSG("GException.outofmemory") |
Detailed Description
Exception class.The library always uses macros G_TRY#, G_THROW#, G_CATCH# and G_ENDCATCH# for throwing and catching exceptions (see {GException.h}). These macros only deal with exceptions of type GException#.
Definition at line 138 of file GException.h.
Member Enumeration Documentation
Constructor & Destructor Documentation
GException::GException | ( | const char * | cause, | |
const char * | file = 0 , |
|||
int | line = 0 , |
|||
const char * | func = 0 , |
|||
const source_type | source = GINTERNAL | |||
) |
Constructs a GException.
This constructor is usually called by macro G_THROW#. Argument cause# is a plain text error message. As a convention, string ByteStream::EndOfFile# is used when reaching an unexpected end-of-file condition and string DataPool::Stop# is used when the user interrupts the execution. The remaining arguments are usually provided by the predefined macros __FILE__#, __LINE__#, and (G++ and EGCS only) __PRETTY_FUNCTION__#.
Definition at line 105 of file GException.cpp.
GException::GException | ( | const GException & | exc | ) |
GException::GException | ( | ) |
GException::~GException | ( | void | ) | [virtual] |
Member Function Documentation
int GException::cmp_cause | ( | const char | s1[], | |
const char | s2[] | |||
) | [static] |
Compares the cause with the specified string, ignoring anything after the first tab.
Definition at line 180 of file GException.cpp.
int GException::cmp_cause | ( | const char | s2[] | ) | const |
Compares the cause with the specified string, ignoring anything after the first tab.
Definition at line 201 of file GException.cpp.
const char * GException::get_cause | ( | void | ) | const |
Returns the string describing the cause of the exception.
The returned pointer is never null. Exception handlers should not rely on the value of the string cause#. As a convention however, string ByteStream::EndOfFile# is used when reaching an unexpected end-of-file condition and string DataPool::Stop# is used when the user interrupts the execution. These strings can be tested by the exception handlers, with cmp_cause#. Similar conventional strings may be defined in the future. They all will be small strings with only uppercase characters.
Definition at line 172 of file GException.cpp.
const char* GException::get_file | ( | void | ) | const [inline] |
Returns the file name from which the exception was thrown.
A null pointer is returned if no file name is available.
Definition at line 195 of file GException.h.
const char* GException::get_function | ( | void | ) | const [inline] |
Returns the function name from which the exception was thrown.
A null pointer is returned if no function name is available.
Definition at line 191 of file GException.h.
int GException::get_line | ( | void | ) | const [inline] |
Returns the line number from which the exception was thrown.
A zero is returned if no line number is available.
Definition at line 202 of file GException.h.
source_type GException::get_source | ( | void | ) | const [inline] |
GException & GException::operator= | ( | const GException & | exc | ) |
void GException::perror | ( | void | ) | const |
Prints an error message on stderr.
This function no longer takes a message parameter because some instances used a i18n message id and other instances used a literal string.
Definition at line 157 of file GException.cpp.
Member Data Documentation
const char *const GException::outofmemory = ERR_MSG("GException.outofmemory") [static] |
Definition at line 202 of file GException.h.
The documentation for this class was generated from the following files: