An abstraction of a XEP-0004 Data Form. More...
#include <dataform.h>
Inherits gloox::StanzaExtension, and gloox::DataFormFieldContainer.
Public Types | |
typedef std::list< DataFormItem * > | ItemList |
Public Member Functions | |
DataForm (FormType type, const StringList &instructions, const std::string &title=EmptyString) | |
DataForm (FormType type, const std::string &title=EmptyString) | |
DataForm (const Tag *tag) | |
DataForm (const DataForm &form) | |
virtual | ~DataForm () |
const std::string & | title () const |
void | setTitle (const std::string &title) |
const StringList & | instructions () const |
void | setInstructions (const StringList &instructions) |
const DataFormReported * | reported () const |
const ItemList & | items () const |
FormType | type () const |
void | setType (FormType type) |
bool | parse (const Tag *tag) |
operator bool () const | |
virtual const std::string & | filterString () const |
virtual StanzaExtension * | newInstance (const Tag *tag) const |
virtual Tag * | tag () const |
virtual StanzaExtension * | clone () const |
An abstraction of a XEP-0004 Data Form.
Definition at line 56 of file dataform.h.
typedef std::list<DataFormItem*> ItemList |
A list of DataFormItems.
Definition at line 62 of file dataform.h.
DataForm | ( | FormType | type, | |
const StringList & | instructions, | |||
const std::string & | title = EmptyString | |||
) |
Constructs a new, empty form.
type | The form type. | |
instructions | Natural-language instructions for filling out the form. Should not contain newlines (\n, \r). | |
title | The natural-language title of the form. Should not contain newlines (\n, \r). |
Definition at line 20 of file dataform.cpp.
DataForm | ( | FormType | type, | |
const std::string & | title = EmptyString | |||
) |
Constructs a new, empty form without any instructions or title set. Probably best suited for result forms.
type | The form type. | |
title | The natural-language title of the form. Should not contain newlines (\n, \r). |
Definition at line 26 of file dataform.cpp.
Constructs a new DataForm from an existing Tag/XML representation.
tag | The existing form to parse. |
Definition at line 32 of file dataform.cpp.
Creates a new DataForm, copying the given one.
form | The form to copy. |
Definition at line 39 of file dataform.cpp.
~DataForm | ( | ) | [virtual] |
Virtual destructor.
Definition at line 46 of file dataform.cpp.
virtual StanzaExtension* clone | ( | ) | const [inline, virtual] |
Returns an identical copy of the current StanzaExtension.
Implements StanzaExtension.
Definition at line 178 of file dataform.h.
const std::string & filterString | ( | ) | const [virtual] |
Returns an XPath expression that describes a path to child elements of a stanza that an extension handles.
Implements StanzaExtension.
Definition at line 96 of file dataform.cpp.
const StringList& instructions | ( | ) | const [inline] |
Retrieves the natural-language instructions for the form.
Definition at line 116 of file dataform.h.
const ItemList& items | ( | ) | const [inline] |
Returns a list of items in a DataForm.
Definition at line 137 of file dataform.h.
virtual StanzaExtension* newInstance | ( | const Tag * | tag | ) | const [inline, virtual] |
Returns a new Instance of the derived type. Usually, for a derived class FooExtension, the implementation of this function looks like:
StanzaExtension* FooExtension::newInstance( const Tag* tag ) const { return new FooExtension( tag ); }
Implements StanzaExtension.
Definition at line 169 of file dataform.h.
operator bool | ( | ) | const [inline] |
Converts to true if the DataForm is valid, false otherwise.
Definition at line 163 of file dataform.h.
bool parse | ( | const Tag * | tag | ) |
Parses the given Tag and creates an appropriate DataForm representation.
tag | The Tag to parse. |
Definition at line 58 of file dataform.cpp.
const DataFormReported* reported | ( | ) | const [inline] |
Returns the reported field list in a DataForm.
Definition at line 131 of file dataform.h.
void setInstructions | ( | const StringList & | instructions | ) | [inline] |
Use this function to set natural-language instructions for the form.
instructions | The instructions for the form. |
Definition at line 125 of file dataform.h.
void setTitle | ( | const std::string & | title | ) | [inline] |
Use this function to set the title of the form.
title | The new title of the form. |
Definition at line 110 of file dataform.h.
void setType | ( | FormType | type | ) | [inline] |
Sets the form's type.
type | The form's new type. |
Definition at line 150 of file dataform.h.
Tag * tag | ( | ) | const [virtual] |
Returns a Tag representation of the extension.
Implements StanzaExtension.
Definition at line 102 of file dataform.cpp.
const std::string& title | ( | ) | const [inline] |
Use this function to retrieve the title of the form.
Definition at line 103 of file dataform.h.
FormType type | ( | ) | const [inline] |
Returns the form's type.
Definition at line 144 of file dataform.h.