#include <tag.h>
Inherited by Stanza.
Inheritance diagram for Tag:
Public Types | |
typedef std::list< Tag * > | TagList |
Public Member Functions | |
Tag () | |
Tag (const std::string &name, const std::string &cdata="", bool incoming=false) | |
Tag (Tag *parent, const std::string &name, const std::string &cdata="", bool incoming=false) | |
virtual | ~Tag () |
virtual const std::string | xml () const |
virtual void | addAttribute (const std::string &name, const std::string &value) |
virtual void | addAttribute (const std::string &name, int value) |
virtual void | addChild (Tag *child) |
virtual void | setCData (const std::string &cdata) |
virtual void | addCData (const std::string &cdata) |
virtual const std::string & | name () const |
virtual const std::string | cdata () const |
virtual StringMap & | attributes () |
virtual const StringMap & | attributes () const |
virtual TagList & | children () |
virtual const TagList & | children () const |
virtual const std::string | findAttribute (const std::string &name) const |
virtual bool | hasAttribute (const std::string &name, const std::string &value="") const |
virtual Tag * | findChild (const std::string &name) |
virtual Tag * | findChild (const std::string &name, const std::string &attr, const std::string &value="") |
virtual bool | hasChild (const std::string &name, const std::string &attr="", const std::string &value="") const |
virtual Tag * | findChildWithAttrib (const std::string &attr, const std::string &value="") |
virtual bool | hasChildWithAttrib (const std::string &attr, const std::string &value="") const |
virtual bool | empty () const |
bool | hasChildWithCData (const std::string &name, const std::string &cdata) const |
Tag * | parent () |
virtual StanzaType | type () const |
virtual Tag * | clone () const |
Protected Attributes | |
std::string | m_name |
StringMap | m_attribs |
std::string | m_cdata |
TagList | m_children |
Tag * | m_parent |
StanzaType | m_type |
bool | m_incoming |
Definition at line 32 of file tag.h.
Tag | ( | ) |
Creates an empty tag.
Definition at line 20 of file tag.cpp.
Referenced by Tag::clone(), Stanza::createIqStanza(), Stanza::createMessageStanza(), Stanza::createPresenceStanza(), and Stanza::createSubscriptionStanza().
Tag | ( | const std::string & | name, | |
const std::string & | cdata = "" , |
|||
bool | incoming = false | |||
) |
Creates a new tag with a given name (and XML character data, if given).
name | The name of the element. | |
cdata | The XML character data of the element. | |
incoming | Indicates whether tag names, attributes, attribute values, and cdata shall be escaped (false, default) or not (true). |
Tag | ( | Tag * | parent, | |
const std::string & | name, | |||
const std::string & | cdata = "" , |
|||
bool | incoming = false | |||
) |
Creates a new tag as a child tag of the given parent, with a given name (and XML character data, if given).
parent | The parent tag. | |
name | The name of the element. | |
cdata | The XML character data of the element. | |
incoming | Indicates whether tag names, attributes, attribute values, and cdata shall be escaped (false, default) or not (true). |
const std::string xml | ( | ) | const [virtual] |
This function can be used to retrieve the complete XML of a tag as a string. It includes all the attributes, child nodes and character data.
Definition at line 62 of file tag.cpp.
Referenced by ClientBase::send().
void addAttribute | ( | const std::string & | name, | |
const std::string & | value | |||
) | [virtual] |
Use this function to add a new attribute to the tag.
name | The name of the attribute. | |
value | The value of the attribute. |
Definition at line 93 of file tag.cpp.
Referenced by RosterManager::ackSubscriptionRequest(), RosterManager::add(), Client::bindResource(), Registration::changePassword(), Registration::createAccount(), Stanza::createIqStanza(), Stanza::createMessageStanza(), Stanza::createPresenceStanza(), Stanza::createSubscriptionStanza(), MessageEventFilter::decorate(), ChatStateFilter::decorate(), NonSaslAuth::doAuth(), FlexibleOffline::fetchMessages(), Registration::fetchRegistrationFields(), Search::fetchSearchFields(), VCardManager::fetchVCard(), RosterManager::fill(), Disco::getDiscoInfo(), Disco::getDiscoItems(), RosterManager::handleIq(), PrivacyManager::handleIq(), LastActivity::handleIq(), InBandBytestreamManager::handleIq(), Disco::handleIq(), NonSaslAuth::handleIqID(), RosterManager::handleSubscription(), ClientBase::processSASLChallenge(), LastActivity::query(), MessageEventFilter::raiseMessageEvent(), Registration::removeAccount(), PrivacyManager::removeList(), FlexibleOffline::removeMessages(), InBandBytestreamManager::requestInBandBytestream(), PrivacyManager::requestList(), PrivacyManager::requestListNames(), PrivateXML::requestXML(), Search::search(), MessageSession::send(), InBandBytestream::sendBlock(), PrivacyManager::setActive(), ChatStateFilter::setChatState(), PrivacyManager::setDefault(), RosterManager::setDelimiter(), ClientBase::startSASL(), ClientBase::startTls(), PrivacyManager::store(), Annotations::storeAnnotations(), BookmarkStorage::storeBookmarks(), VCardManager::storeVCard(), PrivateXML::storeXML(), RosterManager::subscribe(), RosterManager::synchronize(), VCard::tag(), DataFormField::tag(), DataForm::tag(), gloox::tagHook(), PrivacyManager::unsetActive(), PrivacyManager::unsetDefault(), and RosterManager::unsubscribe().
void addAttribute | ( | const std::string & | name, | |
int | value | |||
) | [virtual] |
void addChild | ( | Tag * | child | ) | [virtual] |
Use this function to add a child node to the tag. The Tag will be owned by Tag.
child | The node to be inserted. |
Definition at line 109 of file tag.cpp.
Referenced by Tag::clone(), Registration::createAccount(), Search::search(), Stanza::Stanza(), VCardManager::storeVCard(), PrivateXML::storeXML(), Tag::Tag(), DataFormReported::tag(), DataFormItem::tag(), and gloox::tagHook().
void setCData | ( | const std::string & | cdata | ) | [virtual] |
Sets the XML character data for this Tag.
cdata | The new cdata. |
Definition at line 52 of file tag.cpp.
Referenced by ClientBase::startSASL().
void addCData | ( | const std::string & | cdata | ) | [virtual] |
Adds the string to the existing XML character data for this Tag.
cdata | The additional cdata. |
Definition at line 57 of file tag.cpp.
Referenced by gloox::cdataHook().
virtual const std::string& name | ( | ) | const [inline, virtual] |
Use this function to retrieve the name of an element.
Definition at line 114 of file tag.h.
Referenced by Tag::clone(), DataForm::DataForm(), DataFormItem::DataFormItem(), DataFormReported::DataFormReported(), Component::handleNormalNode(), and gloox::tagHook().
const std::string cdata | ( | ) | const [virtual] |
Use this function to retrieve the XML character data of an element.
Definition at line 118 of file tag.cpp.
Referenced by Tag::clone(), InBandBytestream::filter(), Search::handleIqID(), Registration::handleIqID(), RosterManager::handlePrivateXML(), and Stanza::init().
StringMap & attributes | ( | ) | [virtual] |
Use this function to manipulate the list of attributes.
Definition at line 123 of file tag.cpp.
Referenced by Stanza::Stanza().
virtual const StringMap& attributes | ( | ) | const [inline, virtual] |
Tag::TagList & children | ( | ) | [virtual] |
Use this function to manipulate the list of child elements.
Definition at line 128 of file tag.cpp.
Referenced by DataForm::DataForm(), DataFormField::DataFormField(), DataFormItem::DataFormItem(), DataFormReported::DataFormReported(), FlexibleOffline::handleDiscoItemsResult(), Search::handleIqID(), PrivateXML::handleIqID(), PrivacyManager::handleIqID(), BookmarkStorage::handlePrivateXML(), Annotations::handlePrivateXML(), Stanza::init(), Stanza::Stanza(), and VCard::VCard().
virtual const TagList& children | ( | ) | const [inline, virtual] |
const std::string findAttribute | ( | const std::string & | name | ) | const [virtual] |
This function can be used to retrieve the value of a Tag's attribute.
name | The name of the attribute to look for. |
Definition at line 133 of file tag.cpp.
Referenced by DataFormField::DataFormField(), MessageEventFilter::filter(), InBandBytestream::filter(), PrivacyManager::handleIq(), InBandBytestreamManager::handleIq(), Disco::handleIq(), Adhoc::handleIq(), PrivacyManager::handleIqID(), LastActivity::handleIqID(), and Stanza::init().
bool hasAttribute | ( | const std::string & | name, | |
const std::string & | value = "" | |||
) | const [virtual] |
Checks whether the tag has a attribute with given name and optional value.
name | The name of the attribute to check for. | |
value | The value of the attribute to check for. |
Definition at line 142 of file tag.cpp.
Referenced by DataForm::DataForm(), DataFormField::DataFormField(), FlexibleOffline::handleDiscoItemsResult(), PrivacyManager::handleIq(), InBandBytestreamManager::handleIq(), Search::handleIqID(), NonSaslAuth::handleIqID(), and Stanza::init().
Tag * findChild | ( | const std::string & | name | ) | [virtual] |
This function finds and returns the first element within the child elements of the current tag that has a matching tag name.
name | The name of the element to search for. |
Definition at line 154 of file tag.cpp.
Referenced by MessageEventFilter::filter(), InBandBytestream::filter(), FlexibleOffline::handleDiscoInfoResult(), FlexibleOffline::handleDiscoItemsResult(), Registration::handleIq(), PrivacyManager::handleIq(), InBandBytestreamManager::handleIq(), Disco::handleIq(), Adhoc::handleIq(), VCardManager::handleIqID(), Search::handleIqID(), Registration::handleIqID(), PrivateXML::handleIqID(), PrivacyManager::handleIqID(), NonSaslAuth::handleIqID(), LastActivity::handleIqID(), and Stanza::init().
Tag * findChild | ( | const std::string & | name, | |
const std::string & | attr, | |||
const std::string & | value = "" | |||
) | [virtual] |
This function finds and returns the first element within the child elements of the current tag, that has a certain name, and a certain attribute with a certain value.
name | The name of the element to search for. | |
attr | The name of the attribute of the child element. | |
value | The value of the attribute of the child element. |
bool hasChild | ( | const std::string & | name, | |
const std::string & | attr = "" , |
|||
const std::string & | value = "" | |||
) | const [virtual] |
This function checks whether the Tag has a child element with a given name, and optionally this child element is checked for having a given attribute with an optional value.
name | The name of the child element. | |
attr | The name of the attribute of the child element. | |
value | The value of the attribute of the child element. |
Definition at line 179 of file tag.cpp.
Referenced by MessageEventFilter::filter(), ChatStateFilter::filter(), FlexibleOffline::handleDiscoInfoResult(), Adhoc::handleIq(), Search::handleIqID(), Registration::handleIqID(), PrivacyManager::handleIqID(), NonSaslAuth::handleIqID(), Stanza::init(), and ClientBase::processSASLError().
Tag * findChildWithAttrib | ( | const std::string & | attr, | |
const std::string & | value = "" | |||
) | [virtual] |
This function checks whether the Tag has a child element which posesses a given attribute with an optional value. The name of the child element does not matter.
attr | The name of the attribute of the child element. | |
value | The value of the attribute of the child element. |
Definition at line 222 of file tag.cpp.
Referenced by Stanza::init().
bool hasChildWithAttrib | ( | const std::string & | attr, | |
const std::string & | value = "" | |||
) | const [virtual] |
This function checks whether the Tag has a child element which posesses a given attribute with an optional value. The name of the child element does not matter.
attr | The name of the attribute of the child element. | |
value | The value of the attribute of the child element. |
virtual bool empty | ( | ) | const [inline, virtual] |
bool hasChildWithCData | ( | const std::string & | name, | |
const std::string & | cdata | |||
) | const |
This function checks whether a child element with given name exists and has XML character data that equals the given cdata string.
name | The name of the child element. | |
cdata | The character data that has to exist in the child element. |
Definition at line 196 of file tag.cpp.
Referenced by Stanza::init().
Tag* parent | ( | ) | [inline] |
virtual StanzaType type | ( | ) | const [inline, virtual] |
Returns the stanza type.
Definition at line 234 of file tag.h.
Referenced by ClientBase::send().
Tag * clone | ( | ) | const [virtual] |