00001 /* 00002 Copyright (c) 2006-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 "dataformreported.h" 00015 00016 #include "tag.h" 00017 00018 namespace gloox 00019 { 00020 00021 DataFormReported::DataFormReported() 00022 { 00023 } 00024 00025 DataFormReported::DataFormReported( Tag* tag ) 00026 { 00027 if( tag->name() != "reported" ) 00028 return; 00029 00030 const TagList &l = tag->children(); 00031 TagList::const_iterator it = l.begin(); 00032 for( ; it != l.end(); ++it ) 00033 { 00034 DataFormField* f = new DataFormField( (*it) ); 00035 m_fields.push_back( f ); 00036 } 00037 } 00038 00039 DataFormReported::~DataFormReported() 00040 { 00041 } 00042 00043 Tag* DataFormReported::tag() const 00044 { 00045 Tag* r = new Tag ( "reported" ); 00046 DataFormFieldContainer::FieldList::const_iterator it = m_fields.begin(); 00047 for( ; it != m_fields.end(); ++it ) 00048 { 00049 r->addChild( (*it)->tag() ); 00050 } 00051 return r; 00052 } 00053 00054 }