5#ifndef QXMPPPUBSUBEVENT_H
6#define QXMPPPUBSUBEVENT_H
8#include "QXmppMessage.h"
9#include "QXmppPubSubSubscription.h"
17class QXmppPubSubEventPrivate;
47 void setNode(
const QString &node);
49 QStringList retractIds()
const;
50 void setRetractIds(
const QStringList &);
52 QString redirectUri()
const;
53 void setRedirectUri(
const QString &);
55 std::optional<QXmppPubSubSubscription> subscription()
const;
56 void setSubscription(
const std::optional<QXmppPubSubSubscription> &subscription);
58 std::optional<QXmppDataForm> configurationForm()
const;
59 void setConfigurationForm(
const std::optional<QXmppDataForm> &configurationForm);
63 static bool isPubSubEvent(
const QDomElement &element, std::function<
bool(
const QDomElement &)> isItemValid);
68 virtual void parseItems(
const QDomElement &) = 0;
69 virtual void serializeItems(QXmlStreamWriter *writer)
const = 0;
73 QSharedDataPointer<QXmppPubSubEventPrivate> d;
76template<
typename T = QXmppPubSubBaseItem>
80 QVector<T>
items()
const;
87 void parseItems(
const QDomElement &)
override;
88 void serializeItems(QXmlStreamWriter *writer)
const override;
120 return QXmppPubSubEventBase::isPubSubEvent(element, [](
const QDomElement &element) {
121 return T::isItem(element);
129 QDomElement child = parent.firstChildElement(QStringLiteral(
"item"));
130 while (!child.isNull()) {
135 child = child.nextSiblingElement(QStringLiteral(
"item"));
142 for (
const auto &item : qAsConst(m_items)) {
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:64
virtual bool parseExtension(const QDomElement &element, QXmpp::SceMode)
Definition: QXmppMessage.cpp:1633
virtual void serializeExtensions(QXmlStreamWriter *writer, QXmpp::SceMode, const QString &baseNamespace={}) const
Definition: QXmppMessage.cpp:1896
virtual void parse(const QDomElement &)=0
virtual void toXml(QXmlStreamWriter *writer) const =0
Definition: QXmppPubSubBaseItem.h:19
Definition: QXmppPubSubEvent.h:21
QXmppPubSubEventBase & operator=(const QXmppPubSubEventBase &other)
Default assignment operator.
EventType
Definition: QXmppPubSubEvent.h:26
QXmppPubSubEventBase & operator=(QXmppPubSubEventBase &&)
Default move-assignment operator.
QXmppPubSubEventBase(const QXmppPubSubEventBase &other)
Default copy-constructor.
QXmppPubSubEventBase(QXmppPubSubEventBase &&)
Default move-constructor.
The QXmppPubSubEvent class represents a PubSub event notification as defined by XEP-0060: Publish-Sub...
Definition: QXmppPubSubEvent.h:78
static bool isPubSubEvent(const QDomElement &element)
Definition: QXmppPubSubEvent.h:118
QVector< T > items() const
Definition: QXmppPubSubEvent.h:99
void setItems(const QVector< T > &items)
Definition: QXmppPubSubEvent.h:108
SceMode
Definition: QXmppGlobal.h:136