13 #include "dataformfield.h"
14 #include "dataformbase.h"
21 : m_type( type ), m_required( false )
27 : m_name( name ), m_label( label ), m_type( type ), m_required( false )
29 m_values.push_back( value );
33 : m_type( FieldTypeInvalid ), m_required( false )
68 Tag::TagList::const_iterator it = l.begin();
69 for( ; it != l.end(); ++it )
71 if( (*it)->name() ==
"desc" )
72 m_desc = (*it)->cdata();
73 else if( (*it)->name() ==
"required" )
75 else if( (*it)->name() ==
"value" )
82 else if( (*it)->name() ==
"option" )
86 m_options[(*it)->findAttribute(
"label" )] = v->
cdata();
101 Tag *field =
new Tag(
"field" );
142 new Tag( field,
"required" );
144 if( !m_desc.empty() )
145 new Tag( field,
"desc", m_desc );
149 StringMap::const_iterator it = m_options.begin();
150 for( ; it != m_options.end(); ++it )
152 Tag *option =
new Tag( field,
"option" );
154 new Tag( option,
"value", (*it).second );
159 if( m_values.size() == 0 || m_values.front() ==
"false" || m_values.front() ==
"0" )
160 new Tag( field,
"value",
"0" );
162 new Tag( field,
"value",
"1" );
167 StringList::const_iterator it = m_values.begin();
168 for( ; it != m_values.end() ; ++it )
169 new Tag( field,
"value", (*it) );
174 new Tag( field,
"value", m_values.front() );