Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

jabberoo::Packet Class Reference

A Jabber Packet with standard attributes. More...

#include <packet.hh>

Inheritance diagram for jabberoo::Packet:

jabberoo::Message jabberoo::Presence List of all members.

Public Member Functions

 Packet (const std::string &name)
 Jabber Packet constructor with a base element of name.

 Packet (const judo::Element &t)
 Jabber Packet constructor based upon a judo::Element Create a Jabber Packet based off of a judo::Element.

const std::string getFrom () const
 from attribute on the base element.

const std::string getTo () const
 to attribute on the base element.

const std::string getID () const
 id attribute on the base element.

const std::string getError () const
 error subelement of the base element.

const int getErrorCode () const
 code attribute on the error subelement.

const std::string toString () const
 XML string form of the Jabber Packet.

const judo::ElementgetBaseElement () const
 XML judo::Element form of the Jabber Packet.

void setFrom (const std::string &from)
 from attribute on the base element.

void setTo (const std::string &to)
 to attribute on the base element.

void setID (const std::string &id)
 id attribute on the base element.

judo::ElementaddX ()
 Add x element to the packet.

judo::ElementaddX (const std::string &tnamespace)
 Add x element to the packet.

judo::ElementfindX (const std::string &tnamespace) const
 Get the x (extension) element which has an xmlns of tnamespace.

void eraseX (const std::string &tnamespace)
 Erase an x element from the packet.

judo::ElementgetBaseElement ()
 Access to the base element.


Detailed Description

A Jabber Packet with standard attributes.

This class has accessors and modifiers for several common Jabber attributes and elements.

Definition at line 42 of file packet.hh.


Constructor & Destructor Documentation

jabberoo::Packet::Packet const std::string &    name
 

Jabber Packet constructor with a base element of name.

Create a Jabber Packet with a base element of name.

Parameters:
name A string base element name.

Definition at line 37 of file jabberoo-packet.cpp.

jabberoo::Packet::Packet const judo::Element   t
 

Jabber Packet constructor based upon a judo::Element Create a Jabber Packet based off of a judo::Element.

Parameters:
t A judo::Element

Definition at line 41 of file jabberoo-packet.cpp.


Member Function Documentation

Element * jabberoo::Packet::addX const std::string &    tnamespace
 

Add x element to the packet.

Adds an x (extension) element to the Jabber Packet with the given namespace.

See also:
judo::Element

judo::Element::putAttrib()

Returns:
A pointer to the newly created judo::Element.

Definition at line 104 of file jabberoo-packet.cpp.

References judo::Element::addElement().

Element * jabberoo::Packet::addX  
 

Add x element to the packet.

Adds an x (extension) element to the Jabber Packet. x elements should have an xmlns attribute.

See also:
judo::Element

judo::Element::putAttrib()

Returns:
A pointer to the newly created judo::Element.

Definition at line 99 of file jabberoo-packet.cpp.

References judo::Element::addElement().

Referenced by jabberoo::Message::Message(), jabberoo::Message::requestComposing(), jabberoo::Message::requestDelivered(), and jabberoo::Message::requestDisplayed().

void jabberoo::Packet::eraseX const std::string &    tnamespace
 

Erase an x element from the packet.

Erases an x (extension) element to the Jabber Packet with the given namespace.

See also:
judo::Element
Parameters:
tnamespace The namespace of the x element to return.

Definition at line 126 of file jabberoo-packet.cpp.

References judo::Element::begin(), and judo::Element::end().

Element * jabberoo::Packet::findX const std::string &    tnamespace const
 

Get the x (extension) element which has an xmlns of tnamespace.

See also:
judo::Element
Parameters:
tnamespace The namespace of the x element to return.
Returns:
A pointer to the x element.

Definition at line 111 of file jabberoo-packet.cpp.

References judo::Element::begin(), and judo::Element::end().

Referenced by jabberoo::Message::Message(), jabberoo::Message::requestComposing(), jabberoo::Message::requestDelivered(), and jabberoo::Message::requestDisplayed().

Element & jabberoo::Packet::getBaseElement  
 

Access to the base element.

See also:
judo::Element
Returns:
A reference to the base element of the Jabber Packet as a judo::Element

Definition at line 139 of file jabberoo-packet.cpp.

const Element & jabberoo::Packet::getBaseElement   const
 

XML judo::Element form of the Jabber Packet.

Returns:
The XML forming the Jabber Packet as a judo::Element.
See also:
judo::Element

Definition at line 79 of file jabberoo-packet.cpp.

Referenced by jabberoo::Session::operator<<().

const std::string jabberoo::Packet::getError   const
 

error subelement of the base element.

Returns:
The string in the error subelement of the base element, NULL if the error subelement is nonexistent.

Definition at line 60 of file jabberoo-packet.cpp.

References judo::Element::getChildCData().

const int jabberoo::Packet::getErrorCode   const
 

code attribute on the error subelement.

Returns:
The int in the code attribute on the error subelement, 0 if the code attribute or the error subelement is nonexistent.

Definition at line 65 of file jabberoo-packet.cpp.

References judo::Element::findElement().

const std::string jabberoo::Packet::getFrom   const
 

from attribute on the base element.

Returns:
The string in the from attribute on the base element, NULL if the from attribute is nonexistent.

Definition at line 45 of file jabberoo-packet.cpp.

References judo::Element::getAttrib().

Referenced by jabberoo::PresenceDB::insert(), jabberoo::Message::Message(), jabberoo::Session::operator<<(), and jabberoo::Roster::update().

const std::string jabberoo::Packet::getID   const
 

id attribute on the base element.

Returns:
The string in the id attribute on the base element, NULL if the id attribute is nonexistent.

Definition at line 55 of file jabberoo-packet.cpp.

References judo::Element::getAttrib().

const std::string jabberoo::Packet::getTo   const
 

to attribute on the base element.

Returns:
The string in the to attribute on the base element, NULL if the to attribute is nonexistent.

Definition at line 50 of file jabberoo-packet.cpp.

References judo::Element::getAttrib().

Referenced by jabberoo::Session::operator<<().

void jabberoo::Packet::setFrom const std::string &    from
 

from attribute on the base element.

Parameters:
from The JabberID to go in the from attribute on the base element, normally set by the server.

Definition at line 84 of file jabberoo-packet.cpp.

References judo::Element::putAttrib().

void jabberoo::Packet::setID const std::string &    id
 

id attribute on the base element.

Parameters:
id The string id attribute on the base element.

Definition at line 94 of file jabberoo-packet.cpp.

References judo::Element::putAttrib().

void jabberoo::Packet::setTo const std::string &    to
 

to attribute on the base element.

Parameters:
to The JabberID to send this packet to.

Definition at line 89 of file jabberoo-packet.cpp.

References judo::Element::putAttrib().

Referenced by jabberoo::Message::Message(), and jabberoo::Presence::Presence().

const std::string jabberoo::Packet::toString   const
 

XML string form of the Jabber Packet.

Returns:
The XML forming the Jabber Packet as a std::string.

Definition at line 74 of file jabberoo-packet.cpp.

References judo::Element::toString().

Referenced by jabberoo::Session::operator<<().


The documentation for this class was generated from the following files:
Generated on Thu Jul 24 13:31:53 2003 for jabberoo by doxygen1.3-rc3