dataformbase.h

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 #ifndef DATAFORMBASE_H__
00015 #define DATAFORMBASE_H__
00016 
00017 #include "dataformfield.h"
00018 
00019 #include <string>
00020 #include <list>
00021 
00022 namespace gloox
00023 {
00024 
00033   class GLOOX_API DataFormBase
00034   {
00035     public:
00039       DataFormBase();
00040 
00044       virtual ~DataFormBase();
00045 
00049       typedef std::list<DataFormField*> FieldList;
00050 
00056       bool hasField( const std::string& field );
00057 
00064       DataFormField* field( const std::string& field );
00065 
00070       FieldList& fields() { return m_fields; }
00071 
00077       virtual void setFields( FieldList& fields ) { m_fields = fields; }
00078 
00084       virtual void addField( DataFormField *field ) { m_fields.push_back( field ); }
00085 
00094       DataFormField* addField( DataFormField::DataFormFieldType type, const std::string& name,
00095                                const std::string& value = "", const std::string& label = "" )
00096       { m_fields.push_back( new DataFormField( name, value, label, type ) ); return m_fields.back(); }
00097 
00098     protected:
00099       FieldList m_fields;
00100 
00101   };
00102 
00103 }
00104 
00105 #endif // DATAFORMBASE_H__

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