dataformreported.cpp

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

Generated on Tue May 1 14:20:20 2007 for gloox by  doxygen 1.5.1