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

PException Class Reference

Poslib exception class. More...

List of all members.


Public Member Functions

  PException ()
  default constructor

  PException (const PException &p)
  copy constructor

  PException (char *_message)
  constructor with message

  PException (char *_message, PException &p)
  constructor with message and another exception

  PException (bool formatted, char *_message,...)
  constructor with format string

  ~PException ()
  destructor

PException operator= (const PException &p)
  assignment operator


Public Attributes

char *  message
  the exception error message


Detailed Description

Poslib exception class.

This is the class all Poslib functions will use when they want to notify the caller in case of an error. It has only one member, message, which is a free-form message describing the error. It can be constructed in various ways: by specifying a message, a format string with arguments, and a combination of a message and an other exception.

Definition at line 40 of file exception.h.


Constructor & Destructor Documentation

PException::PException  ) 
 

default constructor

This default constructor for the exception class sets the message to "".

PException::PException const PException p  ) 
 

copy constructor

This destructor makes a copy of another PException.

Parameters:
p  The PException to copy

PException::PException char *  _message  ) 
 

constructor with message

This constructor takes the message to store in the PException. The message parameter will be copied to the PException using a strdup().

Parameters:
_message  The message for the exception

PException::PException char *  _message,
PException p
 

constructor with message and another exception

This constructor takes a message, and another PException. The message variable will consists of the _message parameter and the message of the p parameter. This can be really convenient if you want to re-throw an exception, for example:


        
try { domainname x = "www.acdam.net"; (...) } catch (PException p) { throw PException("Process failed: ", p); }

        
Parameters:
_message  Error message
p  Exception whose message is appended to the error message

PException::PException bool  formatted,
char *  _message,
  ...
 

constructor with format string

This constructor can be used for formatting an error message. The first boolean parameter is only there so that this can be distinguished from other constructors; it has no actual meaning currently (we are thinking what meaning we could give it though - so stay tuned :) ).

This code internally calls vsnprintf, so you don't need to bother about buffer overflows. Do note that the message will be trimmed of at 1024 characters if it becomes too long.

Parameters:
formatted  Ignored.
message  The format string message
...  Arguments for the format string

PException::~PException  ) 
 

destructor

This destructor frees all memory associated with the exception object.


Member Function Documentation

PException& PException::operator= const PException p  ) 
 

assignment operator

This function assigns the message from the PException p to this object.

Parameters:
p  The PException to copy
Returns:
This exception object

Member Data Documentation

char* PException::message
 

the exception error message

The error message of the exception. This is just one piece of free-form text. You can always assume this value is non-NULL.

Definition at line 118 of file exception.h.


The documentation for this class was generated from the following file:
Generated on Fri Dec 24 19:55:16 2004 for Poslib by doxygen 1.3.7