gloox  1.0
Public Member Functions | Protected Member Functions
Stanza Class Reference

#include <stanza.h>

Inheritance diagram for Stanza:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~Stanza ()
void setFrom (const JID &from)
const JIDfrom () const
const JIDto () const
const std::string & id () const
const Errorerror () const
const std::string & xmlLang () const
void addExtension (const StanzaExtension *se)
const StanzaExtensionfindExtension (int type) const
template<class T >
const T * findExtension (int type) const
const StanzaExtensionListextensions () const
void removeExtensions ()
virtual Tagtag () const =0

Protected Member Functions

 Stanza (Tag *tag)
 Stanza (const JID &to)

Detailed Description

This is the base class for XMPP stanza abstractions.

Author:
Jakob Schroeter <js@camaya.net>
Since:
0.4

Definition at line 33 of file stanza.h.


Constructor & Destructor Documentation

~Stanza ( ) [virtual]

Virtual destructor.

Definition at line 42 of file stanza.cpp.

Stanza ( Tag tag) [protected]

Creates a new Stanza, taking from and to addresses from the given Tag.

Parameters:
tagThe Tag to create the Stanza from.
Since:
1.0

Definition at line 31 of file stanza.cpp.

Stanza ( const JID to) [protected]

Creates a new Stanza object and initializes the receiver's JID.

Parameters:
toThe receipient of the Stanza.
Since:
1.0

Definition at line 26 of file stanza.cpp.


Member Function Documentation

void addExtension ( const StanzaExtension se)

Use this function to add a StanzaExtension to this Stanza.

Parameters:
seThe StanzaExtension to add.
Note:
The Stanza will become the owner of the StanzaExtension and will take care of deletion.
Since:
0.9

Definition at line 52 of file stanza.cpp.

const Error * error ( ) const

A convenience function that returns the stanza error condition, if any.

Returns:
The stanza error condition, may be 0.

Definition at line 47 of file stanza.cpp.

const StanzaExtensionList& extensions ( ) const [inline]

Returns the list of the Stanza's extensions.

Returns:
The list of the Stanza's extensions.

Definition at line 113 of file stanza.h.

const StanzaExtension * findExtension ( int  type) const

Finds a StanzaExtension of a particular type.

Parameters:
typeStanzaExtensionType to search for.
Returns:
A pointer to the StanzaExtension, or 0 if none was found.

Definition at line 57 of file stanza.cpp.

const T* findExtension ( int  type) const [inline]

Finds a StanzaExtension of a particular type. Example:

 const MyExtension* c = presence.findExtension<MyExtension>( ExtMyExt );
Parameters:
typeThe extension type to look for.
Returns:
The static_cast' type, or 0 if none was found.

Definition at line 104 of file stanza.h.

const JID& from ( ) const [inline]

Returns the JID the stanza comes from.

Returns:
The origin of the stanza.

Definition at line 51 of file stanza.h.

const std::string& id ( ) const [inline]

Returns the id of the stanza, if set.

Returns:
The ID of the stanza.

Definition at line 63 of file stanza.h.

void removeExtensions ( )

Removes (deletes) all the stanza's extensions.

Definition at line 64 of file stanza.cpp.

void setFrom ( const JID from) [inline]

Sets the 'from' address of the Stanza. This useful for Components .

Parameters:
fromThe from address.

Definition at line 45 of file stanza.h.

virtual Tag* tag ( ) const [pure virtual]

Creates a Tag representation of the Stanza. The Tag is completely independent of the Stanza and will not be updated when the Stanza is modified.

Returns:
A pointer to a Tag representation. It is the job of the caller to delete the Tag.

Implemented in Presence, Message, Subscription, and IQ.

const JID& to ( ) const [inline]

Returns the receiver of the stanza.

Returns:
The stanza's destination.

Definition at line 57 of file stanza.h.

const std::string& xmlLang ( ) const [inline]

Retrieves the value of the xml:lang attribute of this stanza. Default is 'en'.

Returns:
The stanza's default language.

Definition at line 76 of file stanza.h.


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