QXmpp Version: 1.7.0
QXmppFallback.h
1// SPDX-FileCopyrightText: 2024 Linus Jahn <lnj@kaidan.im>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPFALLBACK_H
6#define QXMPPFALLBACK_H
7
8#include "QXmppGlobal.h"
9
10#include <optional>
11
12#include <QSharedDataPointer>
13
14class QDomElement;
15class QXmlStreamWriter;
16
17struct QXmppFallbackPrivate;
18
19class QXMPP_EXPORT QXmppFallback
20{
21public:
22 enum Element {
23 Body,
24 Subject,
25 };
26
27 struct Range {
29 uint32_t start;
31 uint32_t end;
32 };
33
34 struct Reference {
38 std::optional<Range> range;
39 };
40
41 QXmppFallback(const QString &forNamespace, const QVector<Reference> &references);
42 QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppFallback)
43
44 const QString &forNamespace() const;
45 void setForNamespace(const QString &);
46
47 const QVector<Reference> &references() const;
48 void setReferences(const QVector<Reference> &);
49
50 static std::optional<QXmppFallback> fromDom(const QDomElement &);
51 void toXml(QXmlStreamWriter *) const;
52
53private:
54 QSharedDataPointer<QXmppFallbackPrivate> d;
55};
56
57#endif // QXMPPFALLBACK_H
Definition: QXmppFallback.h:20
Element
Definition: QXmppFallback.h:22
Definition: QXmppFallback.h:27
uint32_t start
Start index of the range.
Definition: QXmppFallback.h:29
uint32_t end
End index of the range.
Definition: QXmppFallback.h:31
Definition: QXmppFallback.h:34
Element element
Element of the message stanza this refers to.
Definition: QXmppFallback.h:36
std::optional< Range > range
Optional character range in the text.
Definition: QXmppFallback.h:38