diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-09-10 08:29:02 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-09-10 08:29:02 +0000 |
| commit | f43043e5ac727fc227d7c69673c8747507e72cf0 (patch) | |
| tree | c3e0c01ecca774d6e8f772833b19984ff1c356cc /src | |
| parent | 3488995080d1627f53a4f9215f3a3b67fadb98b1 (diff) | |
| download | qxmpp-f43043e5ac727fc227d7c69673c8747507e72cf0.tar.gz | |
define QXMPP_VERSION as a macro returning an integer (like QT_VERSION),
so that it is possible to write code such as:
#if QXMPP_VERSION >= 0x000300
// we have QXmpp 0.3.0 or later
#endif
Diffstat (limited to 'src')
| -rw-r--r-- | src/QXmppGlobal.cpp | 8 | ||||
| -rw-r--r-- | src/QXmppGlobal.h | 13 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/QXmppGlobal.cpp b/src/QXmppGlobal.cpp index d6459001..e670743d 100644 --- a/src/QXmppGlobal.cpp +++ b/src/QXmppGlobal.cpp @@ -24,11 +24,11 @@ #include "QXmppGlobal.h" -#define QXMPPSTRINGIZE(n) _QXMPPSTRINGIZE(n) -#define _QXMPPSTRINGIZE(n) #n - QString QXmppVersion() { - return QString(QXMPPSTRINGIZE(QXMPP_VERSION)); + return QString("%1.%2.%3").arg( + QString::number((QXMPP_VERSION >> 16) & 0xff), + QString::number((QXMPP_VERSION >> 8) & 0xff), + QString::number(QXMPP_VERSION & 0xff)); } diff --git a/src/QXmppGlobal.h b/src/QXmppGlobal.h index 5bba7259..5862eda0 100644 --- a/src/QXmppGlobal.h +++ b/src/QXmppGlobal.h @@ -25,7 +25,18 @@ #ifndef QXMPPGLOBAL_H #define QXMPPGLOBAL_H -#include "QString" +#include <QString> + +/// This macro expands a numeric value of the form 0xMMNNPP (MM = +/// major, NN = minor, PP = patch) that specifies QXmpp's version +/// number. For example, if you compile your application against +/// QXmpp 1.2.3, the QXMPP_VERSION macro will expand to 0x010203. +/// +/// You can use QXMPP_VERSION to use the latest QXmpp features where +/// available. +/// + +#define QXMPP_VERSION 0x00025a QString QXmppVersion(); |
