00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
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_EXPORT 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
00124 void setOptions( const StringMap& options ) { m_options = options; };
00125
00130 bool required() const { return m_required; };
00131
00136 void setRequired( bool required ) { m_required = required; };
00137
00142 DataFormFieldType type() const { return m_type; };
00143
00148 const std::string& label() const { return m_label; };
00149
00154 void setLabel( const std::string& label ) { m_label = label; };
00155
00160 const std::string& value() const { return m_value; };
00161
00166 void setValue( const std::string& value ) { m_value = value; };
00167
00172 const StringList& values() const { return m_values; };
00173
00179 void setValues( const StringList& values ) { m_values = values; };
00180
00181 private:
00182 StringMap m_options;
00183 StringList m_values;
00184
00185 std::string m_name;
00186 std::string m_desc;
00187 std::string m_label;
00188 std::string m_value;
00189 DataFormFieldType m_type;
00190 bool m_required;
00191 };
00192
00193 }
00194
00195 #endif // DATAFORMFIELD_H__