gloox  1.0.20
dataformitem.cpp
1  /*
2  Copyright (c) 2006-2017 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #include "dataformitem.h"
15 
16 #include "tag.h"
17 
18 namespace gloox
19 {
20 
22  {
23  }
24 
26  {
27  if( tag->name() != "item" )
28  return;
29 
30  const TagList &l = tag->children();
31  TagList::const_iterator it = l.begin();
32  for( ; it != l.end(); ++it )
33  {
34  DataFormField* f = new DataFormField( (*it) );
35  m_fields.push_back( f );
36  }
37  }
38 
40  {
41  }
42 
44  {
45  Tag* i = new Tag ( "item" );
46  DataFormFieldContainer::FieldList::const_iterator it = m_fields.begin();
47  for( ; it != m_fields.end(); ++it )
48  {
49  i->addChild( (*it)->tag() );
50  }
51  return i;
52  }
53 
54 }
An abstraction of a single field in a XEP-0004 Data Form.
Definition: dataformfield.h:33
std::list< Tag * > TagList
Definition: tag.h:26
const std::string & name() const
Definition: tag.h:394
void addChild(Tag *child)
Definition: tag.cpp:424
The namespace for the gloox library.
Definition: adhoc.cpp:27
virtual Tag * tag() const
const TagList & children() const
Definition: tag.cpp:510
This is an abstraction of an XML element.
Definition: tag.h:46