gloox  1.0.28
Public Member Functions | Protected Member Functions | List of all members
Stanza Class Referenceabstract

#include <stanza.h>

Inheritance diagram for Stanza:
Inheritance graph
[legend]

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 ()
 
void setEmbeddedStanza ()
 
bool hasEmbeddedStanza () const
 
StanzaembeddedStanza () const
 
TagembeddedTag () const
 
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 Schröter js@ca.nosp@m.maya.nosp@m..net
Since
0.4

Definition at line 33 of file stanza.h.

Constructor & Destructor Documentation

◆ ~Stanza()

~Stanza ( )
virtual

Virtual destructor.

Definition at line 42 of file stanza.cpp.

◆ Stanza() [1/2]

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() [2/2]

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

◆ addExtension()

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.

◆ embeddedStanza()

Stanza * embeddedStanza ( ) const

This function returns the embedded Stanza. It is only needed by ClientBase/StanzaExtensionFactory. If hasEmbeddedStanza() is true, this function checks every embedded StanzaExtension for an embedded Stanza and returns the first it finds. You should not need to use this function directly.

Returns
The embedded Stanza. May be 0.

Definition at line 69 of file stanza.cpp.

◆ embeddedTag()

Tag * embeddedTag ( ) const

This function returns the embedded Tag that the embedded Stanza is based on. It is only needed by ClientBase/StanzaExtensionFactory. If hasEmbeddedStanza() is true, this function checks every embedded StanzaExtension for an embedded Tag and returns the first it finds. You should not need to use this function directly.

Returns
The embedded Tag. May be 0.

Definition at line 76 of file stanza.cpp.

◆ error()

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.

◆ extensions()

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.

◆ findExtension() [1/2]

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.

◆ findExtension() [2/2]

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.

◆ from()

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.

◆ hasEmbeddedStanza()

bool hasEmbeddedStanza ( ) const
inline

This function indicates whether this Stanza instance contains an embedded Stanza that needs to be checked for further StanzaExtensions. You should not need to use this function directly.

Returns
Whether this Stanza instance contains an embedded Stanza.

Definition at line 135 of file stanza.h.

◆ id()

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.

◆ removeExtensions()

void removeExtensions ( )

Removes (deletes) all the stanza's extensions.

Definition at line 64 of file stanza.cpp.

◆ setEmbeddedStanza()

void setEmbeddedStanza ( )
inline

This function is used by StanzaExtensionFactory to signal ClientBase that this Stanza instance contains an embedded Stanza that needs to be checked for further StanzaExtensions. You should not need to use this function directly.

Definition at line 126 of file stanza.h.

◆ setFrom()

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.

◆ tag()

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 Subscription, Presence, Message, and IQ.

◆ to()

const JID& to ( ) const
inline

Returns the receiver of the stanza.

Returns
The stanza's destination.

Definition at line 57 of file stanza.h.

◆ xmlLang()

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: