gloox  0.9.9.12
dataformitem.cpp
1  /*
2  Copyright (c) 2006-2008 by Jakob Schroeter <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  : DataFormField( FieldTypeItem )
23  {
24  }
25 
27  : DataFormField( FieldTypeItem )
28  {
29  if( tag->name() != "item" )
30  return;
31 
32  Tag::TagList &l = tag->children();
33  Tag::TagList::const_iterator it = l.begin();
34  for( ; it != l.end(); ++it )
35  {
36  DataFormField *f = new DataFormField( (*it) );
37  m_fields.push_back( f );
38  }
39  }
40 
42  {
43  }
44 
46  {
47  Tag *i = new Tag ( "item" );
48  DataFormBase::FieldList::const_iterator it = m_fields.begin();
49  for( ; it != m_fields.end(); ++it )
50  {
51  i->addChild( (*it)->tag() );
52  }
53  return i;
54  }
55 
56 }