18 #include "stanzaextension.h"
19 #include "stanzaextensionfactory.h"
27 : m_xmllang(
"default" ), m_to( to ), m_hasEmbeddedStanza( false )
32 : m_xmllang(
"default" ), m_hasEmbeddedStanza( false )
49 return findExtension<Error>(
ExtError );
54 m_extensionList.push_back( se );
59 StanzaExtensionList::const_iterator it = m_extensionList.begin();
60 for( ; it != m_extensionList.end() && (*it)->extensionType() != type; ++it ) ;
61 return it != m_extensionList.end() ? (*it) : 0;
71 StanzaExtensionList::const_iterator it = m_extensionList.begin();
72 for( ; it != m_extensionList.end() && !(*it)->embeddedStanza(); ++it ) ;
73 return it != m_extensionList.end() ? (*it)->embeddedStanza() : 0;
78 StanzaExtensionList::const_iterator it = m_extensionList.begin();
79 for( ; it != m_extensionList.end() && !(*it)->embeddedTag(); ++it ) ;
80 return it != m_extensionList.end() ? (*it)->embeddedTag() : 0;
84 std::string& defaultLang,
92 std::string& defaultLang,
93 const std::string& data,
94 const std::string& xmllang )
105 (**map)[xmllang] = data;
109 const std::string& Stanza::findLang(
const StringMap* map,
110 const std::string& defaultData,
111 const std::string& lang )
113 if( map && lang !=
"default" )
115 StringMap::const_iterator it = map->find( lang );
116 if( it != map->end() )
122 void Stanza::getLangs(
const StringMap* map,
123 const std::string& defaultData,
124 const std::string& name,
127 if( !defaultData.empty() )
128 new Tag(
tag, name, defaultData );
133 StringMap::const_iterator it = map->begin();
134 for( ; it != map->end(); ++it )
136 Tag* t =
new Tag(
tag, name,
"xml:lang", (*it).first );
137 t->setCData( (*it).second );
A stanza error abstraction implemented as a StanzaExtension.
bool setJID(const std::string &jid)
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
This is the base class for XMPP stanza abstractions.
void addExtension(const StanzaExtension *se)
Stanza * embeddedStanza() const
virtual Tag * tag() const =0
const Error * error() const
Tag * embeddedTag() const
const StanzaExtension * findExtension(int type) const
This is an abstraction of an XML element.
const std::string cdata() const
const std::string & findAttribute(const std::string &name) const
void clearList(std::list< T * > &L)
The namespace for the gloox library.
const std::string EmptyString
std::map< std::string, std::string > StringMap