gloox  1.0
Public Types | Public Member Functions | List of all members
DataForm Class Reference

#include <dataform.h>

Inheritance diagram for DataForm:
Inheritance graph
[legend]

Public Types

typedef std::list< DataFormItem * > ItemList
- Public Types inherited from DataFormFieldContainer
typedef std::list
< DataFormField * > 
FieldList

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 StringListinstructions () const
void setInstructions (const StringList &instructions)
const DataFormReportedreported () const
const ItemListitems () const
FormType type () const
void setType (FormType type)
bool parse (const Tag *tag)
 operator bool () const
virtual const std::string & filterString () const
virtual StanzaExtensionnewInstance (const Tag *tag) const
virtual Tagtag () const
virtual StanzaExtensionclone () const
- Public Member Functions inherited from StanzaExtension
 StanzaExtension (int type)
virtual ~StanzaExtension ()
int extensionType () const
- Public Member Functions inherited from DataFormFieldContainer
 DataFormFieldContainer ()
 DataFormFieldContainer (const DataFormFieldContainer &dffc)
virtual ~DataFormFieldContainer ()
bool hasField (const std::string &field) const
DataFormFieldfield (const std::string &field) const
FieldListfields ()
const FieldListfields () const
virtual void setFields (FieldList &fields)
virtual void addField (DataFormField *field)
DataFormFieldaddField (DataFormField::FieldType type, const std::string &name, const std::string &value=EmptyString, const std::string &label=EmptyString)

Detailed Description

An abstraction of a XEP-0004 Data Form.

Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net
Since
0.7

Definition at line 56 of file dataform.h.

Member Typedef Documentation

typedef std::list<DataFormItem*> ItemList

A list of DataFormItems.

Definition at line 62 of file dataform.h.

Constructor & Destructor Documentation

DataForm ( FormType  type,
const StringList instructions,
const std::string &  title = EmptyString 
)

Constructs a new, empty form.

Parameters
typeThe form type.
instructionsNatural-language instructions for filling out the form. Should not contain newlines (\n, \r).
titleThe natural-language title of the form. Should not contain newlines (\n, \r).

Definition at line 24 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.

Parameters
typeThe form type.
titleThe natural-language title of the form. Should not contain newlines (\n, \r).
Since
0.9

Definition at line 30 of file dataform.cpp.

DataForm ( const Tag tag)

Constructs a new DataForm from an existing Tag/XML representation.

Parameters
tagThe existing form to parse.

Definition at line 36 of file dataform.cpp.

DataForm ( const DataForm form)

Creates a new DataForm, copying the given one.

Parameters
formThe form to copy.

Definition at line 43 of file dataform.cpp.

~DataForm ( )
virtual

Virtual destructor.

Definition at line 50 of file dataform.cpp.

Member Function Documentation

virtual StanzaExtension* clone ( ) const
inlinevirtual

Returns an identical copy of the current StanzaExtension.

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.

Returns
The extension's filter string.

Implements StanzaExtension.

Definition at line 100 of file dataform.cpp.

const StringList& instructions ( ) const
inline

Retrieves the natural-language instructions for the form.

Returns
The fill-in 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.

Returns
A list of items.

Definition at line 137 of file dataform.h.

virtual StanzaExtension* newInstance ( const Tag tag) const
inlinevirtual

Returns a new Instance of the derived type. Usually, for a derived class FooExtension, the implementation of this function looks like:

{
return new FooExtension( tag );
}
Returns
The derived extension's new instance.

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.

Parameters
tagThe Tag to parse.
Returns
True on success, false otherwise.
Since
0.9

Definition at line 62 of file dataform.cpp.

const DataFormReported* reported ( ) const
inline

Returns the reported field list in a DataForm.

Returns
The reported section, containing 0..n fields.

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.

Parameters
instructionsThe instructions for the form.
Note
The instructions should not contain newlines (\n, \r). Instead, every line should be an element of the StringMap. This allows for platform dependent newline handling on the target platform.

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.

Parameters
titleThe new title of the form.
Note
The title should not contain newlines (\n, \r).

Definition at line 110 of file dataform.h.

void setType ( FormType  type)
inline

Sets the form's type.

Parameters
typeThe form's new type.

Definition at line 150 of file dataform.h.

Tag * tag ( ) const
virtual

Returns a Tag representation of the extension.

Returns
A Tag representation of the extension.

Implements StanzaExtension.

Definition at line 106 of file dataform.cpp.

const std::string& title ( ) const
inline

Use this function to retrieve the title of the form.

Returns
The title of the form.

Definition at line 103 of file dataform.h.

FormType type ( ) const
inline

Returns the form's type.

Returns
The form's type.
Since
0.9

Definition at line 144 of file dataform.h.


The documentation for this class was generated from the following files: