gloox  0.9.9.12
dataformreported.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 "dataformreported.h"
15 
16 #include "tag.h"
17 
18 namespace gloox
19 {
20 
22  : DataFormField( FieldTypeReported )
23  {
24  }
25 
27  : DataFormField( FieldTypeReported )
28  {
29  if( tag->name() != "reported" )
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 *r = new Tag ( "reported" );
48  DataFormBase::FieldList::const_iterator it = m_fields.begin();
49  for( ; it != m_fields.end(); ++it )
50  {
51  r->addChild( (*it)->tag() );
52  }
53  return r;
54  }
55 
56 }