Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

StanzaExtension Class Reference

This class abstracts a stanza extension, which is usually an element in a specific namespace. More...

#include <stanzaextension.h>

Inherited by Adhoc::Command, AMP, Capabilities, ChatState, Client::ResourceBind, Client::SessionCreation, ClientBase::Ping, DataForm, DelayedDelivery, Disco::Info, Disco::Items, Disco::SoftwareVersion, Error, FeatureNeg, GPGEncrypted, GPGSigned, InBandBytestream::IBB, Session::Jingle, MessageEvent, MUCRoom::MUCAdmin, MUCRoom::MUCOwner, MUCRoom::MUCUser, Nickname, NonSaslAuth::Query, OOB, PrivateXML::Query, Event, Receipt, Registration::Query, RosterManager::Query, Search::Query, UniqueMUCRoom::Unique, VCard, VCardUpdate, and XHtmlIM.

Inheritance diagram for StanzaExtension:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 StanzaExtension (int type)
virtual ~StanzaExtension ()
virtual const std::string & filterString () const =0
virtual StanzaExtensionnewInstance (const Tag *tag) const =0
virtual Tagtag () const =0
int extensionType () const

Detailed Description

This class abstracts a stanza extension, which is usually an element in a specific namespace.

This class is the base class for almost all protocol extensions in gloox. As such, it should be used whenever an add-on to the core XMPP spec needs to be made. For simple protocols it may suffice to create a sub-class of StanzaExtension. For protocols which require keeping of state, an additional persistent object acting like a manager may be needed.

A Stanza can be extended by additional namespaced child elements. Obviously, it is not viable to include all the kinds of extensions possible. To avoid hard-coding of such extensions into gloox, StanzaExtension can be used to inform the core of gloox about additional supported extensions without it needing to know about the exact implementation.

Note that a StanzaExtension can be used for both sending and receiving of custom protocols. When receiving, gloox requires an appropriate implementation of the pure virtuals filterString() and newInstance(). To be able to properly use the encapsulation, some getters may be necessary. Note that the object you will be dealing with usually is const. For sending StanzaExtensions, a custom constructor (as well as some setters, possibly) is needed. Additionally, an implementation of tag() is required.

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

Definition at line 167 of file stanzaextension.h.


Constructor & Destructor Documentation

StanzaExtension int  type  )  [inline]
 

Constructs an empty StanzaExtension.

Parameters:
type Designates the extension's type. It should be one of StanzaExtensionType for built-in extensions, and it should be higher than ExtUser for custom types.

Definition at line 175 of file stanzaextension.h.

virtual ~StanzaExtension  )  [inline, virtual]
 

Virtual destructor.

Definition at line 180 of file stanzaextension.h.


Member Function Documentation

int extensionType  )  const [inline]
 

Returns the extension's type.

Returns:
The extension's type.

Definition at line 213 of file stanzaextension.h.

virtual const std::string& filterString  )  const [pure 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.

Implemented in Adhoc::Command, AMP, Capabilities, ChatState, DataForm, DelayedDelivery, Disco::Info, Disco::Items, Error, FeatureNeg, GPGEncrypted, GPGSigned, Session::Jingle, MessageEvent, Nickname, OOB, Event, Receipt, Registration::Query, VCard, VCardUpdate, and XHtmlIM.

virtual StanzaExtension* newInstance const Tag tag  )  const [pure 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 );
 }
Returns:
The derived extension's new instance.

Implemented in Adhoc::Command, AMP, Capabilities, ChatState, DataForm, DelayedDelivery, Disco::Info, Disco::Items, Error, FeatureNeg, GPGEncrypted, GPGSigned, Session::Jingle, MessageEvent, Nickname, OOB, Event, Receipt, Registration::Query, VCard, VCardUpdate, and XHtmlIM.

virtual Tag* tag  )  const [pure virtual]
 

Returns a Tag representation of the extension.

Returns:
A Tag representation of the extension.

Implemented in Adhoc::Command, AMP, Capabilities, ChatState, DataForm, DelayedDelivery, Disco::Info, Disco::Items, Error, FeatureNeg, GPGEncrypted, GPGSigned, Session::Jingle, MessageEvent, Nickname, OOB, Event, Receipt, Registration::Query, VCard, VCardUpdate, and XHtmlIM.


The documentation for this class was generated from the following file:
Generated on Tue Apr 22 15:10:15 2008 for gloox by  doxygen 1.4.1