QXmpp Version: 1.5.6
|
Public Member Functions | |
virtual QXmppDataForm | toDataForm () const |
Protected Member Functions | |
virtual QString | formType () const =0 |
virtual void | parseForm (const QXmppDataForm &)=0 |
virtual void | serializeForm (QXmppDataForm &) const =0 |
std::optional< quint32 > | parseUInt (const QVariant &variant) |
std::optional< quint64 > | parseULongLong (const QVariant &variant) |
std::optional< bool > | parseBool (const QVariant &variant) |
Static Protected Member Functions | |
static bool | fromDataForm (const QXmppDataForm &form, QXmppDataFormBase &parent) |
template<typename T > | |
static void | serializeValue (QXmppDataForm &form, QXmppDataForm::Field::Type type, const QString &name, const T &value) |
template<typename T > | |
static void | serializeNullable (QXmppDataForm &form, QXmppDataForm::Field::Type type, const QString &name, const T &value) |
template<typename T > | |
static void | serializeEmptyable (QXmppDataForm &form, QXmppDataForm::Field::Type type, const QString &name, const T &value) |
template<typename T , typename ValueConverter = T (*)(T)> | |
static void | serializeOptional (QXmppDataForm &form, QXmppDataForm::Field::Type type, const QString &name, const std::optional< T > &optional, ValueConverter convert=[](T a) { return a;}) |
template<typename T > | |
static void | serializeOptionalNumber (QXmppDataForm &form, QXmppDataForm::Field::Type type, const QString &name, std::optional< T > optional) |
static void | serializeDatetime (QXmppDataForm &form, const QString &name, const QDateTime &datetime, QXmppDataForm::Field::Type type=QXmppDataForm::Field::TextSingleField) |
QXmppDataFormBase is an abstract class types that can be serialized to data forms.
QXmppDataFormBase based types can easily be converted to QXmppDataForms, it is as simple as this:
To make this work, you will need to at least implement the toDataForm() method. For parsing your type you should also create a static creator method, like this:
|
protectedpure virtual |
Returns the 'FORM_TYPE' value of the parsed form.
Implemented in QXmppPubSubSubAuthorization.
|
staticprotected |
Parses the QXmppDataForm.
|
inlineprotected |
Returns the contained boolean value if the QVariant contains a bool.
|
protectedpure virtual |
This is called when a QXmppDataForm is parsed. You can parse all values from the given form and its fields.
Implemented in QXmppExtensibleDataFormBase.
|
inlineprotected |
Parses an unsigned int from a QVariant (QString). Returns std::nullopt if the no number could be parsed.
|
inlineprotected |
Parses an unsigned long long from a QVariant (QString). Returns std::nullopt if the no number could be parsed.
|
staticprotected |
Adds a new field to the form if the passed QDateTime is valid and formats it as ISO timestamp and always uses UTC.
|
inlinestaticprotected |
Adds a new field to the form if
.
|
protectedpure virtual |
This is called the object is serialized to a QXmppDataForm. You need to create a new QXmppDataForm and serialize all fields and values.
Implemented in QXmppExtensibleDataFormBase, and QXmppPubSubSubAuthorization.
|
inlinestaticprotected |
Adds a new field to the form if
.
|
inlinestaticprotected |
Adds a new field to the form if
.
|
inlinestaticprotected |
Adds a new field to the form if
. Converts the optional's value to QString using QString::number().
|
inlinestaticprotected |
Adds a new field to the form with the given field type, field name and value.
|
virtual |
Serializes all fields to a QXmppDataForm.