15 #include "dataformfield.h"
16 #include "dataformitem.h"
17 #include "dataformreported.h"
26 m_type( type ), m_instructions( instructions ), m_title( title ), m_reported( 0 )
32 m_type( type ), m_title( title ), m_reported( 0 )
45 m_type( form.m_type ), m_instructions( form.m_instructions ),
46 m_title( form.m_title ), m_reported( form.m_reported ? new
DataFormReported( form.m_reported->tag() ) : 0 )
57 static const char* dfTypeValues[] =
59 "form",
"submit",
"cancel",
"result"
72 m_type =
static_cast<FormType>( util::lookup(
type, dfTypeValues ) );
78 TagList::const_iterator it = l.begin();
79 for( ; it != l.end(); ++it )
81 if( (*it)->name() ==
"title" )
82 m_title = (*it)->cdata();
83 else if( (*it)->name() ==
"instructions" )
84 m_instructions.push_back( (*it)->cdata() );
85 else if( (*it)->name() ==
"field" )
87 else if( (*it)->name() ==
"reported" )
89 if( m_reported == NULL )
93 else if( (*it)->name() ==
"item" )
102 static const std::string filter =
"/message/x[@xmlns='" +
XMLNS_X_DATA +
"']";
114 if( !m_title.empty() )
115 new Tag( x,
"title", m_title );
117 StringList::const_iterator it_i = m_instructions.begin();
118 for( ; it_i != m_instructions.end(); ++it_i )
119 new Tag( x,
"instructions", (*it_i) );
121 FieldList::const_iterator it = m_fields.begin();
122 for( ; it != m_fields.end(); ++it )
125 if( m_reported != NULL )
130 ItemList::const_iterator iti = m_items.begin();
131 for( ; iti != m_items.end(); ++iti )
A base class for Adhoc Command plugins (DataForm, IO Data, ...).
This is an abstraction of an XML element.
const std::string xmlns() const
bool addAttribute(Attribute *attr)
void addChild(Tag *child)
const std::string & findAttribute(const std::string &name) const
const std::string & name() const
const TagList & children() const
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
void clearList(std::list< T * > &L)
The namespace for the gloox library.
std::list< Tag * > TagList
std::list< std::string > StringList
const std::string XMLNS_X_DATA