gloox  1.0.28
dataformfieldcontainer.cpp
1 /*
2  Copyright (c) 2005-2023 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 "dataformfieldcontainer.h"
15 #include "util.h"
16 
17 
18 namespace gloox
19 {
20 
22  {
23  }
24 
26  {
27  FieldList::const_iterator it = dffc.m_fields.begin();
28  for( ; it != dffc.m_fields.end(); ++it )
29  {
30  m_fields.push_back( new DataFormField( *(*it) ) );
31  }
32  }
33 
35  {
36  util::clearList( m_fields );
37  }
38 
39  DataFormField* DataFormFieldContainer::field( const std::string& field ) const
40  {
41  FieldList::const_iterator it = m_fields.begin();
42  for( ; it != m_fields.end() && (*it)->name() != field; ++it )
43  ;
44  return it != m_fields.end() ? (*it) : 0;
45  }
46 
47 }
An abstract base class for a XEP-0004 Data Form.
DataFormField * field(const std::string &field) const
An abstraction of a single field in a XEP-0004 Data Form.
Definition: dataformfield.h:34
void clearList(std::list< T * > &L)
Definition: util.h:152
The namespace for the gloox library.
Definition: adhoc.cpp:28