#include <dataformfield.h>
Inherited by DataFormItem, and DataFormReported.
Inheritance diagram for DataFormField:
Public Types | |
enum | DataFormFieldType { FIELD_TYPE_BOOLEAN, FIELD_TYPE_FIXED, FIELD_TYPE_HIDDEN, FIELD_TYPE_JID_MULTI, FIELD_TYPE_JID_SINGLE, FIELD_TYPE_LIST_MULTI, FIELD_TYPE_LIST_SINGLE, FIELD_TYPE_TEXT_MULTI, FIELD_TYPE_TEXT_PRIVATE, FIELD_TYPE_TEXT_SINGLE, FIELD_TYPE_ITEM, FIELD_TYPE_REPORTED, FIELD_TYPE_INVALID, FIELD_TYPE_NONE } |
Public Member Functions | |
DataFormField (DataFormFieldType type=FIELD_TYPE_TEXT_SINGLE) | |
DataFormField (Tag *tag) | |
virtual | ~DataFormField () |
StringMap & | options () |
virtual Tag * | tag () const |
virtual const std::string & | name () const |
void | setName (const std::string &name) |
void | setOptions (const StringMap &options) |
bool | required () const |
void | setRequired (bool required) |
DataFormFieldType | type () const |
const std::string & | label () const |
void | setLabel (const std::string &label) |
const std::string & | value () const |
void | setValue (const std::string &value) |
const StringList & | values () const |
void | setValues (const StringList &values) |
Definition at line 31 of file dataformfield.h.
enum DataFormFieldType |
Describes the possible type of a Data Form Field.
FIELD_TYPE_BOOLEAN | The field enables an entity to gather or provide an either-or choice between two options. The default value is "false". |
FIELD_TYPE_FIXED | The field is intended for data description (e.g., human-readable text such as "section" headers) rather than data gathering or provision. The <value/> child SHOULD NOT contain newlines (the \n and \r characters); instead an application SHOULD generate multiple fixed fields, each with one <value/> child. |
FIELD_TYPE_HIDDEN | The field is not shown to the entity providing information, but instead is returned with the form. |
FIELD_TYPE_JID_MULTI | The field enables an entity to gather or provide multiple Jabber IDs. |
FIELD_TYPE_JID_SINGLE | The field enables an entity to gather or provide a single Jabber ID. |
FIELD_TYPE_LIST_MULTI | The field enables an entity to gather or provide one or more options from among many. |
FIELD_TYPE_LIST_SINGLE | The field enables an entity to gather or provide one option from among many. |
FIELD_TYPE_TEXT_MULTI | The field enables an entity to gather or provide multiple lines of text. |
FIELD_TYPE_TEXT_PRIVATE | The field enables an entity to gather or provide a single line or word of text, which shall be obscured in an interface (e.g., *****). |
FIELD_TYPE_TEXT_SINGLE | The field enables an entity to gather or provide a single line or word of text, which may be shown in an interface. This field type is the default and MUST be assumed if an entity receives a field type it does not understand. |
FIELD_TYPE_ITEM | The field really is an element of type 'item' which allows for addition of sub-fields. See the explanantion in JEP-0004 (Data Forms) Section 3.4 for more information |
FIELD_TYPE_REPORTED | The field really is an element of type 'reported' which allows for addition of sub-fields. See the explanantion in JEP-0004 (Data Forms) Section 3.4 for more information |
FIELD_TYPE_INVALID | The field is invalid. Only possible if the field was created from a Tag not correctly describing a Data Form Field. |
FIELD_TYPE_NONE | The field is child of either a <reported> or <item> element. Do not use. |
Definition at line 38 of file dataformfield.h.
DataFormField | ( | DataFormFieldType | type = FIELD_TYPE_TEXT_SINGLE |
) |
Constructs a new Data Form Field.
type | The type of the field. Default: text-single. |
Definition at line 20 of file dataformfield.cpp.
Referenced by DataFormItem::DataFormItem(), and DataFormReported::DataFormReported().
DataFormField | ( | Tag * | tag | ) |
Constructs a new Data Form Field from an existing tag that describes a field.
tag | The tag to parse. |
Definition at line 25 of file dataformfield.cpp.
~DataFormField | ( | ) | [virtual] |
Virtual destructor.
Definition at line 85 of file dataformfield.cpp.
StringMap& options | ( | ) | [inline] |
Use this function to retrieve the optional values of a field.
Definition at line 98 of file dataformfield.h.
Tag * tag | ( | ) | const [virtual] |
Use this function to create a Tag representation of the form field. This is usually called by DataForm.
Definition at line 89 of file dataformfield.cpp.
Referenced by DataFormField::DataFormField().
virtual const std::string& name | ( | ) | const [inline, virtual] |
Use this function to retrieve the name of the field (the content of the 'var' attribute).
Definition at line 112 of file dataformfield.h.
void setName | ( | const std::string & | name | ) | [inline] |
Sets the name (the content of the 'var' attribute) of the field. The name identifies the field uniquely in the form.
name | The new name of the field. |
Definition at line 120 of file dataformfield.h.
void setOptions | ( | const StringMap & | options | ) | [inline] |
Use this function to set the optional values of the field. The key of the map will be used as the label of the option, while the value will be used as ... the value. ;)
options | The optional values of a list* or *multi type of field. |
Definition at line 128 of file dataformfield.h.
bool required | ( | ) | const [inline] |
Use this function to determine whether or not this field is required.
Definition at line 134 of file dataformfield.h.
void setRequired | ( | bool | required | ) | [inline] |
Use this field to set this field to be required.
required | Whether or not this field is required. |
Definition at line 140 of file dataformfield.h.
DataFormFieldType type | ( | ) | const [inline] |
Use this function to retrieve the type of this field.
Definition at line 146 of file dataformfield.h.
const std::string& label | ( | ) | const [inline] |
Use this function to retrieve the describing label of this field.
Definition at line 152 of file dataformfield.h.
void setLabel | ( | const std::string & | label | ) | [inline] |
Use this function to set the describing label of this field.
label | The describing label of this field. |
Definition at line 158 of file dataformfield.h.
const std::string& value | ( | ) | const [inline] |
Use this function to retrieve the value of this field.
Definition at line 164 of file dataformfield.h.
void setValue | ( | const std::string & | value | ) | [inline] |
Use this function to set the value of this field.
value | The new value of this field. |
Definition at line 170 of file dataformfield.h.
const StringList& values | ( | ) | const [inline] |
Use this function to retrieve the values of this field, if its of type 'text-multi'.
Definition at line 176 of file dataformfield.h.
void setValues | ( | const StringList & | values | ) | [inline] |
Use this function to set multiple values of this field, if it is of type 'text-multi'. If its not, use setValue() instead.
values | The new values of this field. |
Definition at line 183 of file dataformfield.h.