QXmppPubSubBaseItem Class

Header: #include <QXmppPubSubBaseItem>
Since: QXmpp 1.5
Inherited By:

QXmppGeolocItem, QXmppMixConfigItem, QXmppMixInfoItem, QXmppMixParticipantItem, and QXmppTuneItem

Public Functions

QXmppPubSubBaseItem(const QString &id = {}, const QString &publisher = {})
QXmppPubSubBaseItem(const QXmppPubSubBaseItem &iq)
QXmppPubSubBaseItem(QXmppPubSubBaseItem &&)
QString id() const
QString publisher() const
void setId(const QString &id)
void setPublisher(const QString &publisher)
QXmppPubSubBaseItem &operator=(QXmppPubSubBaseItem &&iq)
QXmppPubSubBaseItem &operator=(const QXmppPubSubBaseItem &iq)

Static Public Members

bool isItem(const QDomElement &element)

Protected Functions

virtual void parsePayload(const QDomElement &payloadElement)
virtual void serializePayload(QXmlStreamWriter *writer) const

Detailed Description

The QXmppPubSubBaseItem class represents a publish-subscribe item as defined by XEP-0060: Publish-Subscribe.

To access the payload of an item, you need to create a derived class of this and override QXmppPubSubBaseItem::parsePayload() and QXmppPubSubBaseItem::serializePayload().

It is also required that you override QXmppPubSubBaseItem::isItem() and also check for the correct payload of the PubSub item. This can be easily done by using the protected overload of isItem() with an function that checks the tag name and namespace of the payload. The function is only called if a payload exists.

In short, you need to reimplement these methods:

Member Function Documentation

QXmppPubSubBaseItem::QXmppPubSubBaseItem(const QString &id = {}, const QString &publisher = {})

Constructs an item with id and publisher.

[noexcept] QXmppPubSubBaseItem::QXmppPubSubBaseItem(const QXmppPubSubBaseItem &iq)

Default copy-constructor

[noexcept] QXmppPubSubBaseItem::QXmppPubSubBaseItem(QXmppPubSubBaseItem &&)

Default move-constructor

QString QXmppPubSubBaseItem::id() const

Returns the ID of the PubSub item.

See also setId().

[static] bool QXmppPubSubBaseItem::isItem(const QDomElement &element)

Returns true, if the element is possibly a PubSub item.

[virtual protected] void QXmppPubSubBaseItem::parsePayload(const QDomElement &payloadElement)

Parses the payload payloadElement of the item (the child element of the &lt;item/&gt;).

This method needs to be overriden to perform the payload-specific parsing.

QString QXmppPubSubBaseItem::publisher() const

Returns the JID of the publisher of the item.

See also setPublisher().

[virtual protected] void QXmppPubSubBaseItem::serializePayload(QXmlStreamWriter *writer) const

Serializes the payload of the item (the child element of the &lt;item/&gt;).

This method needs to be overriden to perform the payload-specific serialization.

writer.

void QXmppPubSubBaseItem::setId(const QString &id)

Sets the ID of the PubSub item to id.

See also id().

void QXmppPubSubBaseItem::setPublisher(const QString &publisher)

Sets the JID of the publisher of the item.

See also publisher().

[noexcept] QXmppPubSubBaseItem &QXmppPubSubBaseItem::operator=(QXmppPubSubBaseItem &&iq)

Default move-assignment operator, moving from iq.

[noexcept] QXmppPubSubBaseItem &QXmppPubSubBaseItem::operator=(const QXmppPubSubBaseItem &iq)

Default assignment operator, copying iq.