dataformbase.cpp

00001 /*
00002   Copyright (c) 2005-2007 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #include "dataformbase.h"
00015 #include "dataformitem.h"
00016 #include "dataformreported.h"
00017 
00018 
00019 namespace gloox
00020 {
00021 
00022   DataFormBase::DataFormBase()
00023   {
00024   }
00025 
00026   DataFormBase::~DataFormBase()
00027   {
00028     FieldList::iterator it = m_fields.begin();
00029     for( ; it != m_fields.end(); ++it )
00030     {
00031       delete (*it);
00032       (*it) = 0;
00033     }
00034   }
00035 
00036   bool DataFormBase::hasField( const std::string& field )
00037   {
00038     FieldList::const_iterator it = m_fields.begin();
00039     for( ; it != m_fields.end(); ++it )
00040     {
00041       if( (*it)->name() == field )
00042         return true;
00043     }
00044 
00045     return false;
00046   }
00047 
00048   DataFormField* DataFormBase::field( const std::string& field )
00049   {
00050     FieldList::const_iterator it = m_fields.begin();
00051     for( ; it != m_fields.end(); ++it )
00052     {
00053       if( (*it)->name() == field )
00054         return (*it);
00055     }
00056 
00057     return 0;
00058   }
00059 
00060 }

Generated on Sat Nov 10 08:50:27 2007 for gloox by  doxygen 1.5.3-20071008