QXmpp Version: 1.5.6
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
QXmppExtensibleDataFormBase Class Reference
Inheritance diagram for QXmppExtensibleDataFormBase:
Inheritance graph
[legend]
Collaboration diagram for QXmppExtensibleDataFormBase:
Collaboration graph
[legend]

Public Member Functions

QList< QXmppDataForm::FieldunknownFields () const
 
void setUnknownFields (const QList< QXmppDataForm::Field > &unknownFields)
 
- Public Member Functions inherited from QXmppDataFormBase
virtual QXmppDataForm toDataForm () const
 

Protected Member Functions

void parseForm (const QXmppDataForm &) override
 
void serializeForm (QXmppDataForm &) const override
 
virtual bool parseField (const QXmppDataForm::Field &)
 
- Protected Member Functions inherited from QXmppDataFormBase
virtual QString formType () const =0
 
std::optional< quint32 > parseUInt (const QVariant &variant)
 
std::optional< quint64 > parseULongLong (const QVariant &variant)
 
std::optional< bool > parseBool (const QVariant &variant)
 

Additional Inherited Members

- Static Protected Member Functions inherited from QXmppDataFormBase
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)
 

Detailed Description

This class is used for parsing a QXmppDataForm in an extensible way with inheritance and keeping additional unknown fields.

When inheriting you need to reimplement parseField(), serializeForm() and formType(). Also you should add a static parsing function (e.g. QXmppPubSubMetadata::fromDataForm()).

Since
QXmpp 1.5

Member Function Documentation

◆ parseField()

bool QXmppExtensibleDataFormBase::parseField ( const QXmppDataForm::Field )
protectedvirtual

Returns true if a field has been parsed.

Should be reimplemented to do actual parsing. All fields that can't be parsed end up as unknownFields().

Reimplemented in QXmppPubSubSubAuthorization.

◆ parseForm()

void QXmppExtensibleDataFormBase::parseForm ( const QXmppDataForm )
overrideprotectedvirtual

This is called when a QXmppDataForm is parsed. You can parse all values from the given form and its fields.

Implements QXmppDataFormBase.

◆ serializeForm()

void QXmppExtensibleDataFormBase::serializeForm ( QXmppDataForm ) const
overrideprotectedvirtual

This is called the object is serialized to a QXmppDataForm. You need to create a new QXmppDataForm and serialize all fields and values.

Implements QXmppDataFormBase.

Reimplemented in QXmppPubSubSubAuthorization.

◆ setUnknownFields()

void QXmppExtensibleDataFormBase::setUnknownFields ( const QList< QXmppDataForm::Field > &  unknownFields)

Sets all additional fields to be serialized.

◆ unknownFields()

QList< QXmppDataForm::Field > QXmppExtensibleDataFormBase::unknownFields ( ) const

Returns all fields that couldn't be parsed.


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