xmltooling 3.2.4

Public Types | Public Member Functions | Static Public Member Functions | List of all members
xmltooling::XMLToolingException Class Reference

Base exception class, supports parametrized messages and XML serialization. More...

`#include <xmltooling/exceptions.h>`

Inheritance diagram for xmltooling::XMLToolingException:
[legend]
Collaboration diagram for xmltooling::XMLToolingException:
[legend]

## Public Types
typedef XMLToolingException * | ExceptionFactory()
| A factory function that returns an empty exception object of a given type.

## Public Member Functions
| XMLToolingException (const char *msg=0, const params &p=params())
| Constructs an exception using a message and positional parameters.
| XMLToolingException (const char *msg, const namedparams &p)
| Constructs an exception using a message and named parameters.
| XMLToolingException (const std::string &msg, const params &p=params())
| Constructs an exception using a message and positional parameters.
| XMLToolingException (const std::string &msg, const namedparams &p)
| Constructs an exception using a message and named parameters.
const char * | getMessage () const
| Returns the error message, after processing any parameter references.
const char * | what () const throw ()
| Returns the error message, after processing any parameter references.
void | setMessage (const char *msg)
| Sets the error message.
void | setMessage (const std::string &msg)
| Sets the error message.
void | addProperties (const params &p)
| Attach a set of positional parameters to the exception.
void | addProperties (const namedparams &p)
| Attach a set of named parameters to the exception.
void | addProperty (const char *value)
| Attach a single positional parameter at the next available position.
void | addProperty (const char *name, const char *value)
| Attach a single named parameter.
const char * | getProperty (unsigned int index) const
| Returns the parameter property with the designated position (based from one).
const char * | getProperty (const char *name) const
| Returns the parameter property with the designated name.
virtual void | raise () const
| Raises an exception using itself.
virtual const char * | getClassName () const
| Returns a unique name for the exception class.
std::string | toString () const
| Returns a string containing a serialized representation of the exception.
std::string | toQueryString () const
| Returns a set of query string name/value pairs, URL-encoded, representing the exception's type, message, and parameters.

## Static Public Member Functions
static XMLToolingException * | getInstance (const char *exceptionClass)
| Builds an empty exception of the given type.
static XMLToolingException * | fromStream (std::istream &in)
| Builds an exception from a serialized input stream.
static XMLToolingException * | fromString (const char *s)
| Builds an exception from a serialized input buffer.
static void | registerFactory (const char *exceptionClass, ExceptionFactory *factory)
| Registers a factory to create exceptions of a given class name.
static void | deregisterFactory (const char *exceptionClass)
| Unregisters the factory for a given class name.
static void | deregisterFactories ()
| Unregisters all factories.

## Detailed Description

Base exception class, supports parametrized messages and XML serialization.

Parameters are prefixed with a dollar sign ($) and can be positional ($1) or named ($info).

## Constructor & Destructor Documentation

## ◆ XMLToolingException() [1/4]

xmltooling::XMLToolingException::XMLToolingException | ( | const char * | msg = 0,
|  | const params & | p = params() )

Constructs an exception using a message and positional parameters.

Parameters

  msg | error message
  p | an ordered set of positional parameter strings

## ◆ XMLToolingException() [2/4]

xmltooling::XMLToolingException::XMLToolingException | ( | const char * | msg,
|  | const namedparams & | p )

Constructs an exception using a message and named parameters.

Parameters

  msg | error message
  p | a set of named parameter strings

## ◆ XMLToolingException() [3/4]

xmltooling::XMLToolingException::XMLToolingException | ( | const std::string & | msg,
|  | const params & | p = params() )

Constructs an exception using a message and positional parameters.

Parameters

  msg | error message
  p | an ordered set of positional parameter strings

## ◆ XMLToolingException() [4/4]

xmltooling::XMLToolingException::XMLToolingException | ( | const std::string & | msg,
|  | const namedparams & | p )

Constructs an exception using a message and named parameters.

Parameters

  msg | error message
  p | a set of named parameter strings

## Member Function Documentation

## ◆ addProperties() [1/2]

void xmltooling::XMLToolingException::addProperties | ( | const namedparams & | p | ) |

Attach a set of named parameters to the exception.

Parameters

  p | a set of named parameter strings

## ◆ addProperties() [2/2]

void xmltooling::XMLToolingException::addProperties | ( | const params & | p | ) |

Attach a set of positional parameters to the exception.

Parameters

  p | an ordered set of named parameter strings

## ◆ addProperty() [1/2]

void xmltooling::XMLToolingException::addProperty | ( | const char * | name,
|  | const char * | value )
| inline

Attach a single named parameter.

Parameters

  name | the parameter name
  value | the parameter value

## ◆ addProperty() [2/2]

void xmltooling::XMLToolingException::addProperty | ( | const char * | value | ) |
| inline

Attach a single positional parameter at the next available position.

Parameters

  value | the parameter value

## ◆ deregisterFactory()

static void xmltooling::XMLToolingException::deregisterFactory | ( | const char * | exceptionClass | ) |
| inline static

Unregisters the factory for a given class name.

Parameters

  exceptionClass | name of exception type

## ◆ fromStream()

static XMLToolingException * xmltooling::XMLToolingException::fromStream | ( | std::istream & | in | ) |
| static

Builds an exception from a serialized input stream.

Parameters

  in | input stream

Returns
  the exception object found in the stream

## ◆ fromString()

static XMLToolingException * xmltooling::XMLToolingException::fromString | ( | const char * | s | ) |
| static

Builds an exception from a serialized input buffer.

Parameters

  s | input buffer

Returns
  the exception object found in the buffer

## ◆ getClassName()

virtual const char * xmltooling::XMLToolingException::getClassName | ( |  | ) | const
| inline virtual

Returns a unique name for the exception class.

Returns
  class name

Reimplemented in xmlencryption::DecryptionException, xmlencryption::EncryptionException, xmlsignature::SignatureException, xmltooling::IOException, xmltooling::MarshallingException, xmltooling::ThreadingException, xmltooling::UnknownAttributeException, xmltooling::UnknownElementException, xmltooling::UnknownExtensionException, xmltooling::UnmarshallingException, xmltooling::ValidationException, xmltooling::XMLObjectException, xmltooling::XMLParserException, and xmltooling::XMLSecurityException.

## ◆ getInstance()

static XMLToolingException * xmltooling::XMLToolingException::getInstance | ( | const char * | exceptionClass | ) |
| static

Builds an empty exception of the given type.

Parameters

  exceptionClass | the name of the exception type to build

Returns
  an empty exception object

## ◆ getMessage()

const char * xmltooling::XMLToolingException::getMessage | ( |  | ) | const

Returns the error message, after processing any parameter references.

Returns
  the processed message

## ◆ getProperty() [1/2]

const char * xmltooling::XMLToolingException::getProperty | ( | const char * | name | ) | const

Returns the parameter property with the designated name.

Parameters

  name | named parameter to access

Returns
  the parameter property or nullptr

## ◆ getProperty() [2/2]

const char * xmltooling::XMLToolingException::getProperty | ( | unsigned int | index | ) | const

Returns the parameter property with the designated position (based from one).

Parameters

  index | position to access

Returns
  the parameter property or nullptr

## ◆ raise()

virtual void xmltooling::XMLToolingException::raise | ( |  | ) | const
| inline virtual

Raises an exception using itself.

Used to raise an exception of a derived type.

Reimplemented in xmlencryption::DecryptionException, xmlencryption::EncryptionException, xmlsignature::SignatureException, xmltooling::IOException, xmltooling::MarshallingException, xmltooling::ThreadingException, xmltooling::UnknownAttributeException, xmltooling::UnknownElementException, xmltooling::UnknownExtensionException, xmltooling::UnmarshallingException, xmltooling::ValidationException, xmltooling::XMLObjectException, xmltooling::XMLParserException, and xmltooling::XMLSecurityException.

## ◆ registerFactory()

static void xmltooling::XMLToolingException::registerFactory | ( | const char * | exceptionClass,
|  | ExceptionFactory * | factory )
| inline static

Registers a factory to create exceptions of a given class name.

Parameters

  exceptionClass | name of exception type
  factory | factory function to build exceptions with

## ◆ setMessage() [1/2]

void xmltooling::XMLToolingException::setMessage | ( | const char * | msg | ) |

Sets the error message.

Parameters

  msg | the error message

## ◆ setMessage() [2/2]

void xmltooling::XMLToolingException::setMessage | ( | const std::string & | msg | ) |
| inline

Sets the error message.

Parameters

  msg | the error message

## ◆ toQueryString()

std::string xmltooling::XMLToolingException::toQueryString | ( |  | ) | const

Returns a set of query string name/value pairs, URL-encoded, representing the exception's type, message, and parameters.

Returns
  the query string representation

## ◆ toString()

std::string xmltooling::XMLToolingException::toString | ( |  | ) | const

Returns a string containing a serialized representation of the exception.

Returns
  the serialization

## ◆ what()

const char * xmltooling::XMLToolingException::what | ( |  | ) | const
throw | ( | ) |  |  |
| inline

Returns the error message, after processing any parameter references.

Returns
  the processed message

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

- xmltooling/exceptions.h