gloox  0.9.9.12
dataformbase.cpp
1 /*
2  Copyright (c) 2005-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 "dataformbase.h"
15 #include "dataformitem.h"
16 #include "dataformreported.h"
17 
18 
19 namespace gloox
20 {
21 
23  {
24  }
25 
27  {
28  FieldList::iterator it = m_fields.begin();
29  for( ; it != m_fields.end(); ++it )
30  {
31  delete (*it);
32  (*it) = 0;
33  }
34  }
35 
36  bool DataFormBase::hasField( const std::string& field )
37  {
38  FieldList::const_iterator it = m_fields.begin();
39  for( ; it != m_fields.end(); ++it )
40  {
41  if( (*it)->name() == field )
42  return true;
43  }
44 
45  return false;
46  }
47 
48  DataFormField* DataFormBase::field( const std::string& field )
49  {
50  FieldList::const_iterator it = m_fields.begin();
51  for( ; it != m_fields.end(); ++it )
52  {
53  if( (*it)->name() == field )
54  return (*it);
55  }
56 
57  return 0;
58  }
59 
60 }