QXmpp Version: 1.11.3
Loading...
Searching...
No Matches
QXmppGlobal.h
1// SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
2// SPDX-FileCopyrightText: 2017 Niels Ole Salscheider <niels_ole@salscheider-online.de>
3// SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im>
4// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
5//
6// SPDX-License-Identifier: LGPL-2.1-or-later
7
8#ifndef QXMPPGLOBAL_H
9#define QXMPPGLOBAL_H
10
11#include "qxmpp_export.h"
12
13#include <QString>
14
15#define QXMPP_AUTOTEST_EXPORT
16#define QXMPP_PRIVATE_EXPORT QXMPP_EXPORT
17
27#define QXMPP_VERSION QT_VERSION_CHECK(QXMPP_VERSION_MAJOR, QXMPP_VERSION_MINOR, QXMPP_VERSION_PATCH)
28
32inline QLatin1String QXmppVersion()
33{
34 return QLatin1String(
35 QT_STRINGIFY(QXMPP_VERSION_MAJOR) "." QT_STRINGIFY(QXMPP_VERSION_MINOR) "." QT_STRINGIFY(QXMPP_VERSION_PATCH));
36}
37
38// This sets which deprecated functions should still be usable
39// It works exactly like QT_DISABLE_DEPRECATED_BEFORE
40#ifndef QXMPP_DISABLE_DEPRECATED_BEFORE
41#define QXMPP_DISABLE_DEPRECATED_BEFORE 0x0
42#endif
43
44// This works exactly like QT_DEPRECATED_SINCE, but checks QXMPP_DISABLE_DEPRECATED_BEFORE instead.
45#define QXMPP_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QXMPP_DISABLE_DEPRECATED_BEFORE)
46
47// workaround for Qt < 5.12
48#ifndef Q_DECL_ENUMERATOR_DEPRECATED_X
49#define Q_DECL_ENUMERATOR_DEPRECATED_X(msg)
50#endif
51
52#ifndef QT_WARNING_DISABLE_DEPRECATED
53#define QT_WARNING_DISABLE_DEPRECATED
54#endif
55
56// Adds constructor and operator declarations to a ".h" file corresponding to the rule of six.
57// A default constructor has to be declared manually.
58#define QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(name) \
59 name(const name &); \
60 name(name &&) noexcept; \
61 ~name(); \
62 name &operator=(const name &); \
63 name &operator=(name &&) noexcept;
64
65// Adds constructor and operator definitions to a ".cpp" file corresponding to the rule of six.
66// A default constructor has to be defined manually.
67#define QXMPP_PRIVATE_DEFINE_RULE_OF_SIX(name) \
68 name::name(const name &) = default; \
69 name::name(name &&) noexcept = default; \
70 name::~name() = default; \
71 name &name::operator=(const name &) = default; \
72 name &name::operator=(name &&) noexcept = default;
73// Same as QXMPP_PRIVATE_DEFINE_RULE_OF_SIX but for an inner class.
74#define QXMPP_PRIVATE_DEFINE_RULE_OF_SIX_INNER(outer, name) \
75 outer::name::name(const outer::name &) = default; \
76 outer::name::name(outer::name &&) noexcept = default; \
77 outer::name::~name() = default; \
78 outer::name &outer::name::operator=(const outer::name &) = default; \
79 outer::name &outer::name::operator=(outer::name &&) noexcept = default;
80
88namespace QXmpp {
89
114
115// Keep in sync with namespaces and names in Global/Message.cpp!
116
117#if QXMPP_DEPRECATED_SINCE(1, 5)
134#endif
135};
136
149
158inline constexpr bool operator&(SceMode mode1, SceMode mode2)
159{
160 return mode1 == SceAll || mode1 == mode2;
161}
162
168enum Cipher {
169 Aes128GcmNoPad,
170 Aes256GcmNoPad,
171 Aes256CbcPkcs7,
172};
173
179struct Success { };
180
186struct Cancelled { };
187
195struct TimeoutError { };
196
197} // namespace QXmpp
198
199#endif // QXMPPGLOBAL_H
Definition Algorithms.h:14
Cipher
Definition QXmppGlobal.h:168
constexpr bool operator&(SceMode mode1, SceMode mode2)
Definition QXmppGlobal.h:158
SceMode
Definition QXmppGlobal.h:144
@ SceSensitive
Only processes sensitive elements that should be encrypted.
Definition QXmppGlobal.h:147
@ SceAll
Processes all known elements.
Definition QXmppGlobal.h:145
@ ScePublic
Only processes 'public' elements (e.g. needed for routing).
Definition QXmppGlobal.h:146
EncryptionMethod
Definition QXmppGlobal.h:97
@ LegacyOpenPgp
XEP-0027: Current Jabber OpenPGP Usage
Definition QXmppGlobal.h:105
@ OMEMO
Definition QXmppGlobal.h:133
@ Omemo0
XEP-0384: OMEMO Encryption
Definition QXmppGlobal.h:109
@ Ox
XEP-0373: OpenPGP for XMPP
Definition QXmppGlobal.h:107
@ Omemo2
XEP-0384: OMEMO Encryption since version 0.8
Definition QXmppGlobal.h:113
@ OTR
Definition QXmppGlobal.h:121
@ Otr
XEP-0364: Current Off-the-Record Messaging Usage
Definition QXmppGlobal.h:103
@ NoEncryption
No encryption.
Definition QXmppGlobal.h:99
@ OX
Definition QXmppGlobal.h:129
@ LegacyOpenPGP
Definition QXmppGlobal.h:125
@ Omemo1
XEP-0384: OMEMO Encryption since version 0.4
Definition QXmppGlobal.h:111
@ UnknownEncryption
Unknown encryption.
Definition QXmppGlobal.h:101
Definition QXmppGlobal.h:186
Definition QXmppGlobal.h:179
Definition QXmppGlobal.h:195