GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | List of all members
Glip::Exception Class Reference

Exception class, derived from std::exception. More...

#include <Exception.hpp>

Inherits exception.

Public Types

enum  Type {
  UnspecifiedException,
  CoreException,
  ModuleException,
  GLException,
  ClientShaderException,
  ClientScriptException,
  ClientException
}
 Exception type. More...
 

Public Member Functions

 Exception (const std::string &m, std::string f="", int l=-1, const Type &t=UnspecifiedException)
 Exception constructor. More...
 
 Exception (const Exception &e)
 Exception constructor. More...
 
Type getType (void) const
 Get the type of the exception. More...
 
const char * what (void) const throw ()
 Get the complete exception message. More...
 
const std::string & getMessage (void) const throw ()
 Get the exception message. More...
 
const std::string & getFilename (void) const throw ()
 Get the filename the exception was generated from. More...
 
std::string getShortFilename (void) const
 Get the last part of the filename (following the last separator). More...
 
int getLineNumber (void) const throw ()
 Get the line number the exception was generated from. More...
 
Exceptionoperator= (const std::exception &e)
 Copy an exception. More...
 
Exceptionoperator= (const Exception &e)
 Copy an exception. More...
 
Exceptionoperator<< (const std::exception &e)
 Concatenate the mesages of two exceptions. More...
 
Exceptionoperator<< (const Exception &e)
 Concatenate the mesages of two exceptions. More...
 
void append (const Exception &e)
 Concatenate the messages of two exceptions. Note that this is a reversed version of operator<<. More...
 
void prepend (const Exception &e)
 Concatenate the messages of two exceptions. Use this version to serially concatenate multiple descriptions. More...
 
int getNumSubExceptions (void) const throw ()
 Get the number of sub-error embedded. More...
 
const ExceptiongetSubException (int i)
 Return the sub-error at index i. More...
 
bool isSubException (void) const
 Test if the exception is a subordinate. More...
 
void hideHeader (bool enabled=true)
 Hide (or show) the headers in messages provided by what(). More...
 
bool isHeaderHidden (void) const
 Test if the header will be shown in the exception message. More...
 

Detailed Description

Exception class, derived from std::exception.

Member Enumeration Documentation

Exception type.

Enumerator
UnspecifiedException 

Unspecified exception (default if not specified).

CoreException 

From a core library component.

ModuleException 

From a Module.

GLException 

From a glCall, or similar.

ClientShaderException 

From a failed shader compilation, with code provided by the client.

ClientScriptException 

From a failed script evaluaton, with code provided by the client.

ClientException 

Client type exception.

Constructor & Destructor Documentation

Exception::Exception ( const std::string &  m,
std::string  f = "",
int  l = -1,
const Type t = UnspecifiedException 
)

Exception constructor.

Parameters
mMessage.
fFile name (FILE).
lLine number (LINE).
tType of the exception (see Exception::Type).
Exception::Exception ( const Exception e)

Exception constructor.

Parameters
eCopy.

Member Function Documentation

void Exception::append ( const Exception e)

Concatenate the messages of two exceptions. Note that this is a reversed version of operator<<.

Parameters
eA sub Exception.
const std::string & Exception::getFilename ( void  ) const
throw (
)

Get the filename the exception was generated from.

Returns
Reference to a std::string containing the filename.
int Exception::getLineNumber ( void  ) const
throw (
)

Get the line number the exception was generated from.

Returns
The line number.
const std::string & Exception::getMessage ( void  ) const
throw (
)

Get the exception message.

Returns
Reference to a std::string containing the message.
int Exception::getNumSubExceptions ( void  ) const
throw (
)

Get the number of sub-error embedded.

Returns
The number of sub-error embedded.
std::string Exception::getShortFilename ( void  ) const

Get the last part of the filename (following the last separator).

Returns
String containing the shortened filename.
const Exception & Exception::getSubException ( int  i)

Return the sub-error at index i.

Parameters
iThe index of the sub-error.
Returns
Return the sub-error corresponding at index i or raise an error if the index is invalid.
Exception::Type Exception::getType ( void  ) const

Get the type of the exception.

Returns
The type of this exception (see Exception::Type).
void Exception::hideHeader ( bool  enabled = true)

Hide (or show) the headers in messages provided by what().

Parameters
enabledtrue (default) to hide the headers or true to show them.
bool Exception::isHeaderHidden ( void  ) const

Test if the header will be shown in the exception message.

Returns
True if the header is hidden.
bool Exception::isSubException ( void  ) const

Test if the exception is a subordinate.

Returns
True if the exception is a subordinate.
Exception & Exception::operator<< ( const std::exception &  e)

Concatenate the mesages of two exceptions.

Parameters
eThe original exception.
Returns
This exception message followed by the original exception message.
Exception & Exception::operator<< ( const Exception e)

Concatenate the mesages of two exceptions.

Parameters
eThe original Exception.
Returns
This exception message followed by the original exception message.
Exception & Exception::operator= ( const std::exception &  e)

Copy an exception.

Parameters
eSource exception.
Returns
Reference to this exception.
Exception & Exception::operator= ( const Exception e)

Copy an exception.

Parameters
eSource exception.
Returns
Reference to this exception.
void Exception::prepend ( const Exception e)

Concatenate the messages of two exceptions. Use this version to serially concatenate multiple descriptions.

Parameters
eA sub Exception.
const char * Exception::what ( void  ) const
throw (
)

Get the complete exception message.

Returns
C string.

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