00001 /* 00002 Copyright (c) 2005-2009 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 "dataformfieldcontainer.h" 00015 #include "util.h" 00016 00017 00018 namespace gloox 00019 { 00020 00021 DataFormFieldContainer::DataFormFieldContainer() 00022 { 00023 } 00024 00025 DataFormFieldContainer::DataFormFieldContainer( const DataFormFieldContainer& dffc ) 00026 { 00027 FieldList::const_iterator it = dffc.m_fields.begin(); 00028 for( ; it != dffc.m_fields.end(); ++it ) 00029 { 00030 m_fields.push_back( new DataFormField( *(*it) ) ); 00031 } 00032 } 00033 00034 DataFormFieldContainer::~DataFormFieldContainer() 00035 { 00036 util::clearList( m_fields ); 00037 } 00038 00039 DataFormField* DataFormFieldContainer::field( const std::string& field ) const 00040 { 00041 FieldList::const_iterator it = m_fields.begin(); 00042 for( ; it != m_fields.end() && (*it)->name() != field; ++it ) 00043 ; 00044 return it != m_fields.end() ? (*it) : 0; 00045 } 00046 00047 }