aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2019-09-28 00:14:13 +0200
committerLNJ <lnj@kaidan.im>2019-10-14 21:33:09 +0200
commita6c90186b4f95183a8b40e1c44dc4b4bdb48cbc4 (patch)
tree08690c56ae5294deb9285fecd3b3ab34b3e2e986 /src
parent438ae3683012c7e2e128c6e56980aa3b344d1a48 (diff)
downloadqxmpp-a6c90186b4f95183a8b40e1c44dc4b4bdb48cbc4.tar.gz
Add deprecation system similiar to Qt's
This adds the QXMPP_DISABLE_DEPRECATED_BEFORE option and a QXMPP_DEPRECATED_SINCE(major, minor) macro. They work like their Qt equivalent: - QXMPP_DISABLE_DEPRECATED_BEFORE defines the version number of source compatibility to be kept with. By default this is the major version (e.g. QXmpp 1.0.0) - QXMPP_DEPRECATED_SINCE(major, minor) returns true, if functions that got deprecated at this version should still be included.
Diffstat (limited to 'src')
-rw-r--r--src/base/QXmppGlobal.h.in10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/base/QXmppGlobal.h.in b/src/base/QXmppGlobal.h.in
index f562eb04..992e02b1 100644
--- a/src/base/QXmppGlobal.h.in
+++ b/src/base/QXmppGlobal.h.in
@@ -4,6 +4,7 @@
* Author:
* Manjeet Dahiya
* Niels Ole Salscheider
+ * Linus Jahn
*
* Source:
* https://github.com/qxmpp-project/qxmpp
@@ -52,5 +53,14 @@ inline QLatin1String QXmppVersion()
return QLatin1String("@VERSION_STRING@");
}
+// This sets which deprecated functions should still be usable
+// It works exactly like QT_DISABLE_DEPRECATED_BEFORE
+#ifndef QXMPP_DISABLE_DEPRECATED_BEFORE
+# define QXMPP_DISABLE_DEPRECATED_BEFORE 0x@VERSION_MAJOR@ << 16
+#endif
+
+// This works exactly like QT_DEPRECATED_SINCE, but checks QXMPP_DISABLE_DEPRECATED_BEFORE instead.
+#define QXMPP_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QXMPP_DISABLE_DEPRECATED_BEFORE)
+
#endif //QXMPPGLOBAL_H