libquentier  0.4.0
The library for rich desktop clients of Evernote service
Macros.h
1 /*
2  * Copyright 2016 Dmitry Ivanov
3  *
4  * This file is part of libquentier
5  *
6  * libquentier is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * libquentier is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LIB_QUENTIER_UTILITY_MACROS_H
20 #define LIB_QUENTIER_UTILITY_MACROS_H
21 
22 #include <QtGlobal>
23 #include <QString>
24 
25 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
26 
27 #ifndef Q_DECL_OVERRIDE
28 #ifdef CPP11_COMPLIANT
29 #define Q_DECL_OVERRIDE override
30 #else
31 #define Q_DECL_OVERRIDE
32 #endif
33 #endif // Q_DECL_OVERRIDE
34 
35 #ifndef Q_DECL_FINAL
36 #ifdef CPP11_COMPLIANT
37 #define Q_DECL_FINAL final
38 #else
39 #define Q_DECL_FINAL
40 #endif
41 #endif // Q_DECL_FINAL
42 
43 #ifndef Q_STATIC_ASSERT_X
44 #ifdef CPP11_COMPLIANT
45 #define Q_STATIC_ASSERT_X(x1,x2) static_assert(x1, x2)
46 #else
47 #define Q_STATIC_ASSERT_X(x1,x2)
48 #endif
49 #endif // Q_STATIC_ASSERT_X
50 
51 #ifndef QStringLiteral
52 #define QStringLiteral(x) QString::fromUtf8(x, sizeof(x) - 1)
53 #endif
54 
55 #ifndef Q_NULLPTR
56 #ifdef CPP11_COMPLIANT
57 #define Q_NULLPTR nullptr
58 #else
59 #define Q_NULLPTR NULL
60 #endif
61 #endif
62 
63 #endif // QT_VERSION
64 
65 #ifdef QNSIGNAL
66 #undef QNSIGNAL
67 #endif
68 
69 #ifdef QNSLOT
70 #undef QNSLOT
71 #endif
72 
73 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) || (defined(_MSC_VER) && (_MSC_VER <= 1600))
74 #define QNSIGNAL(className, methodName, ...) SIGNAL(methodName(__VA_ARGS__))
75 #define QNSLOT(className, methodName, ...) SLOT(methodName(__VA_ARGS__))
76 #else
77 #define QNSIGNAL(className, methodName, ...) &className::methodName
78 #define QNSLOT(className, methodName, ...) &className::methodName
79 #endif
80 
81 #if defined(_MSC_VER) && (_MSC_VER <= 1800)
82 #ifdef QStringLiteral
83 #undef QStringLiteral
84 #define QStringLiteral(x) QString::fromUtf8(x, sizeof(x) - 1)
85 #endif
86 #endif
87 
88 #ifndef Q_DECL_EQ_DELETE
89 #ifdef CPP11_COMPLIANT
90 #define Q_DECL_EQ_DELETE = delete
91 #else
92 #define Q_DECL_EQ_DELETE
93 #endif
94 #endif // Q_DECL_EQ_DELETE
95 
96 #endif // LIB_QUENTIER_UTILITY_MACROS_H