Error Class Reference

`#include <error.h>`

Inheritance diagram for Error:
[legend]

## Public Member Functions

| Error (const Tag *tag=0)
| Error (StanzaErrorType type, StanzaError error, Tag *appError=0)
virtual | ~Error ()
StanzaErrorType | type () const
StanzaError | error () const
const Tag * | appError () const
void | setAppError (Tag *appError)
const std::string & | text (const std::string &lang=EmptyString) const
void | setText (const std::string &text, const std::string &lang=EmptyString)
virtual const std::string & | filterString () const
virtual StanzaExtension * | newInstance (const Tag *tag) const
virtual Tag * | tag () const
virtual StanzaExtension * | clone () const
Public Member Functions inherited from StanzaExtension
| StanzaExtension (int type)
virtual | ~StanzaExtension ()
virtual Stanza * | embeddedStanza () const
virtual Tag * | embeddedTag () const
int | extensionType () const

## Detailed Description

A stanza error abstraction implemented as a StanzaExtension.

Author
  Vincent Thomasset
  Jakob Schröter js@ca.nosp@m.maya.nosp@m..net

Since
  1.0

Definition at line 34 of file error.h.

## Constructor & Destructor Documentation

## Error() [1/2]

Error | ( | const Tag * | tag = 0 | ) |

Creates a new Error object from the given Tag.

Parameters

  tag | The Tag to parse.

Definition at line 67 of file error.cpp.

## Error() [2/2]

Error | ( | StanzaErrorType | type,
|  | StanzaError | error,
|  | Tag * | appError = 0 )

inline

Creates a new Error object.

Parameters

  type | The error type.
  error | The actual stanza error.
  appError | An optional application-specific error.

Definition at line 55 of file error.h.

## ~Error()

~Error | ( |  | ) |

virtual

Virtual destructor.

Definition at line 94 of file error.cpp.

## Member Function Documentation

## appError()

const Tag * appError | ( |  | ) | const

inline

This function can be used to retrieve the application-specific error condition of a stanza error.

Returns
  The application-specific error element of a stanza error. 0 if no respective element was found or no error occured.

Definition at line 83 of file error.h.

## clone()

virtual StanzaExtension * clone | ( |  | ) | const

inline virtual

Returns an identical copy of the current StanzaExtension.

Returns
  An identical copy of the current StanzaExtension.

Implements StanzaExtension.

Definition at line 127 of file error.h.

## error()

StanzaError error | ( |  | ) | const

inline

Return the stanza error.

Returns
  The actual error.

Definition at line 75 of file error.h.

## filterString()

const std::string & filterString | ( |  | ) | const

virtual

Returns an XPath expression that describes a path to child elements of a stanza that an extension handles.

Returns
  The extension's filter string.

Implements StanzaExtension.

Definition at line 99 of file error.cpp.

## newInstance()

virtual StanzaExtension * newInstance | ( | const Tag * | tag | ) | const

inline virtual

Returns a new Instance of the derived type. Usually, for a derived class FooExtension, the implementation of this function looks like:

StanzaExtension* FooExtension::newInstance( const Tag* tag ) const
{
return new FooExtension( tag );
}
gloox::Error::tag
virtual Tag * tag() const
Definition error.cpp:109
gloox::StanzaExtension::StanzaExtension
StanzaExtension(int type)
Definition stanzaextension.h:211
gloox::Tag
This is an abstraction of an XML element.
Definition tag.h:47

Returns
  The derived extension's new instance.

Implements StanzaExtension.

Definition at line 118 of file error.h.

## setAppError()

void setAppError | ( | Tag * | appError | ) |

Sets the application-specific error condition of a stanza error.

Parameters

  appError | The application-specific error element of a stanza error. The Error object will own and delete the Tag.

Definition at line 138 of file error.cpp.

## setText()

void setText | ( | const std::string & | text,
|  | const std::string & | lang = EmptyString )

inline

Sets the text of a error stanza for the given language.

Parameters

  text | The error text to set.
  lang | The language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default text will be set.

Definition at line 109 of file error.h.

## tag()

Tag * tag | ( |  | ) | const

virtual

Returns a Tag representation of the extension.

Returns
  A Tag representation of the extension.

Implements StanzaExtension.

Definition at line 109 of file error.cpp.

## text()

const std::string & text | ( | const std::string & | lang = EmptyString | ) | const

Returns the text of a error stanza for the given language if available. If the requested language is not available, the default text (without a xml:lang attribute) will be returned.

Parameters

  lang | The language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default text will be returned, if any.

Returns
  The text of an error stanza.

Definition at line 132 of file error.cpp.

## type()

StanzaErrorType type | ( |  | ) | const

inline

Returns the error type.

Returns
  The error type.

Definition at line 69 of file error.h.

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

- error.h
- error.cpp