18 #include "stanzaextension.h"
19 #include "stanzaextensionfactory.h"
27 : m_xmllang(
"default" ), m_to( to )
32 : m_xmllang(
"default" )
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;
70 std::string& defaultLang,
78 std::string& defaultLang,
79 const std::string& data,
80 const std::string& xmllang )
91 (**map)[xmllang] = data;
95 const std::string& Stanza::findLang(
const StringMap* map,
96 const std::string& defaultData,
97 const std::string& lang )
99 if( map && lang !=
"default" )
101 StringMap::const_iterator it = map->find( lang );
102 if( it != map->end() )
108 void Stanza::getLangs(
const StringMap* map,
109 const std::string& defaultData,
110 const std::string& name,
113 if( !defaultData.empty() )
114 new Tag( tag, name, defaultData );
119 StringMap::const_iterator it = map->begin();
120 for( ; it != map->end(); ++it )
122 Tag* t =
new Tag( tag, name,
"xml:lang", (*it).first );
123 t->setCData( (*it).second );
void clearList(std::list< T * > &L)
void addExtension(const StanzaExtension *se)
A stanza error abstraction implemented as a StanzaExtension.
bool setJID(const std::string &jid)
This class abstracts a stanza extension, which is usually an element in a specific namespace...
const std::string & findAttribute(const std::string &name) const
std::map< std::string, std::string > StringMap
const std::string cdata() const
const Error * error() const
const std::string EmptyString
const StanzaExtension * findExtension(int type) const
This is an abstraction of an XML element.