dataformfield.h

00001 /*
00002   Copyright (c) 2005-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 #ifndef DATAFORMFIELD_H__
00015 #define DATAFORMFIELD_H__
00016 
00017 #include "gloox.h"
00018 
00019 #include <string>
00020 
00021 namespace gloox
00022 {
00023 
00024   class Tag;
00031   class GLOOX_API DataFormField
00032   {
00033     public:
00034 
00038       enum DataFormFieldType
00039       {
00040         FIELD_TYPE_BOOLEAN,         
00042         FIELD_TYPE_FIXED,           
00047         FIELD_TYPE_HIDDEN,          
00049         FIELD_TYPE_JID_MULTI,       
00051         FIELD_TYPE_JID_SINGLE,      
00053         FIELD_TYPE_LIST_MULTI,      
00055         FIELD_TYPE_LIST_SINGLE,     
00057         FIELD_TYPE_TEXT_MULTI,      
00059         FIELD_TYPE_TEXT_PRIVATE,    
00061         FIELD_TYPE_TEXT_SINGLE,     
00065         FIELD_TYPE_ITEM,            
00068         FIELD_TYPE_REPORTED,        
00071         FIELD_TYPE_INVALID          
00073       };
00074 
00079       DataFormField( DataFormFieldType type = FIELD_TYPE_TEXT_SINGLE );
00080 
00085       DataFormField( Tag *tag );
00086 
00090       virtual ~DataFormField();
00091 
00096       StringMap& options() { return m_options; };
00097 
00104       virtual Tag* tag() const;
00105 
00110       virtual const std::string& name() const { return m_name; };
00111 
00118       void setName( const std::string& name ) { m_name = name; };
00119 
00126       void setOptions( const StringMap& options ) { m_options = options; };
00127 
00132       bool required() const { return m_required; };
00133 
00138       void setRequired( bool required ) { m_required = required; };
00139 
00144       DataFormFieldType type() const { return m_type; };
00145 
00150       const std::string& label() const { return m_label; };
00151 
00156       void setLabel( const std::string& label ) { m_label = label; };
00157 
00162       const std::string& value() const { return m_value; };
00163 
00168       void setValue( const std::string& value ) { m_value = value; };
00169 
00174       const StringList& values() const { return m_values; };
00175 
00181       void setValues( const StringList& values ) { m_values = values; };
00182 
00183     private:
00184       StringMap m_options;
00185       StringList m_values;
00186 
00187       std::string m_name;
00188       std::string m_desc;
00189       std::string m_label;
00190       std::string m_value;
00191       DataFormFieldType m_type;
00192       bool m_required;
00193   };
00194 
00195 }
00196 
00197 #endif // DATAFORMFIELD_H__

Generated on Sun Sep 24 21:57:31 2006 for gloox by  doxygen 1.4.7