forked from Greedysky/TTKDownloader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ttkglobal.h
198 lines (166 loc) · 5.77 KB
/
ttkglobal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#ifndef TTKGLOBAL_H
#define TTKGLOBAL_H
/* =================================================
* This file is part of the TTK Downloader project
* Copyright (C) 2015 - 2020 Greedysky Studio
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; If not, see <http://www.gnu.org/licenses/>.
================================================= */
#include <QMap>
#include <QSet>
#include <QVariant>
#include <QtCore/qglobal.h>
#ifdef Q_CC_GNU
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
# define TTK_GREATER_NEW
# if QT_VERSION >= QT_VERSION_CHECK(5,2,0)
# define TTK_WINEXTRAS
# else
# define TTK_NO_WINEXTRAS
# endif
#else
# define TTK_NO_WINEXTRAS
#endif
//
#ifdef QT_DEBUG
# define TTK_DEBUG
#endif
///
#ifdef __cplusplus
# define TTK_CAST
#endif
///cast
#ifdef TTK_CAST
# define MConst_cast(x,y) (const_cast< x >(y))
#else
# define MConst_cast(x,y) ((x)(y))
#endif
#ifdef TTK_CAST
# define MDynamic_cast(x,y) (dynamic_cast< x >(y))
#else
# define MDynamic_cast(x,y) ((x)(y))
#endif
#ifdef TTK_CAST
# define MReinterpret_cast(x,y) (reinterpret_cast< x >(y))
#else
# define MReinterpret_cast(x,y) ((x)(y))
#endif
#ifdef TTK_CAST
# define MStatic_cast(x,y) (static_cast< x >(y))
#else
# define MStatic_cast(x,y) ((x)(y))
#endif
#ifdef TTK_CAST
# define MObject_cast(x,y) (qobject_cast< x >(y))
#else
# define MObject_cast(x,y) (qobject_cast< x >(y))
#endif
///
#define M_IN const &
#define M_OT &
#define M_RT const
#define M_RD &
#define M_RR const &
#define M_CT const
#define M_CR const &
/*
* C++11 keywords and expressions
*/
#ifdef Q_COMPILER_NULLPTR
# define M_NULLPTR nullptr
#else
# define M_NULLPTR NULL
#endif
#ifdef Q_COMPILER_DEFAULT_MEMBERS
# define M_DEFAULT = default
#else
# define M_DEFAULT
#endif
#ifdef Q_COMPILER_DELETE_MEMBERS
# define M_DELETE = delete
#else
# define M_DELETE
#endif
#ifdef Q_COMPILER_EXPLICIT_OVERRIDES
# define M_OVERRIDE override
# define M_FINAL final
#else
# ifndef M_OVERRIDE
# define M_OVERRIDE
# endif
# ifndef M_FINAL
# define M_FINAL
# endif
#endif
///
#define TTK_NAN_STR "NaN"
#define TTK_STR_SPLITER "*|||*"
///
#define TTK_DECLARE_PTR(Class) \
public: \
using Class##Ptr = Class *; \
using Class##CPtr = const Class *;
#define TTK_DECLARE_GCN(Class) \
public: \
inline static QString getClassName() \
{ \
return #Class; \
}
#define TTK_DECLARE_MODULE(Class) \
public: \
TTK_DECLARE_PTR(Class) \
TTK_DECLARE_GCN(Class)
///
#ifndef _MSC_VER
//gcc version less than 3.4.0
#if __GNUC__ <= 3 && __GNUC_MINOR__ <= 4
#define STRCAT(a, b) a##b
#else
#define STRCAT(a, b) a b
#endif
#else
#define STRCAT(a, b) a b
#endif
#define TTK_DECLARE_LISTS(Class) \
typedef QList<Class> Class##s;
#define TTK_DECLARE_FLAGS(Flags, Enum) \
typedef QFlags<Enum> Flags;
///
typedef signed char MInt8; /* 8 bit signed */
typedef unsigned char MUInt8; /* 8 bit unsigned */
typedef short MInt16; /* 16 bit signed */
typedef unsigned short MUInt16; /* 16 bit unsigned */
typedef int MInt32; /* 32 bit signed */
typedef unsigned int MUInt32; /* 32 bit unsigned */
typedef long long MInt64; /* 64 bit signed */
typedef unsigned long long MUInt64; /* 64 bit unsigned */
typedef double MDouble; /* double */
typedef float MFloat; /* float */
typedef bool MBool; /* bool */
typedef std::string MString; /* string */
///
typedef QList<QVariant> MVariantList; /* variantlist */
typedef QList<int> MIntList; /* intlist */
typedef QSet<QVariant> MVariantSet; /* variantset */
typedef QSet<int> MIntSet; /* intset */
typedef QMap<QString, QVariant> MVariantMap; /* stringVariantMap */
typedef QMap<QString, QString> MStringMap; /* stringsMap */
typedef QMap<QString, QStringList> MStringListMap; /* stringStrlistsMap */
typedef QMap<int, MIntList> MIntListMap; /* intIntlistMap */
typedef QMap<qint64, QString> MIntStringMap; /* intStrMap */
typedef QMapIterator<QString, QVariant> MVariantMapIterator; /* stringVariantMapIterator */
typedef QMapIterator<QString, QString> MStringMapterator; /* stringsMapIterator */
typedef QMapIterator<QString, QStringList> MStringListMapIterator; /* stringStrlistsMapIterator */
typedef QMapIterator<int, MIntList> MIntListMapIterator; /* intIntlistMapIterator */
typedef QMapIterator<qint64, QString> MIntStringMapIterator; /* intStrMapIterator */
#endif // TTKGLOBAL_H