Qx
v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-macros.h
Go to the documentation of this file.
1
#ifndef QX_MACROS_H
2
#define QX_MACROS_H
3
4
// Helper
6
#define __QX_MACRO_EXPAND1(...) __VA_ARGS__
7
#define __QX_MACRO_EXPAND2(...) __QX_MACRO_EXPAND1(__QX_MACRO_EXPAND1(__VA_ARGS__))
8
#define __QX_MACRO_EXPAND4(...) __QX_MACRO_EXPAND2(__QX_MACRO_EXPAND2(__VA_ARGS__))
9
#define __QX_MACRO_EXPAND8(...) __QX_MACRO_EXPAND4(__QX_MACRO_EXPAND4(__VA_ARGS__))
10
#define __QX_MACRO_EXPAND16(...) __QX_MACRO_EXPAND8(__QX_MACRO_EXPAND8(__VA_ARGS__))
11
#define __QX_MACRO_EXPAND32(...) __QX_MACRO_EXPAND8(__QX_MACRO_EXPAND8(__VA_ARGS__))
12
#define __QX_MACRO_EXPAND64(...) __QX_MACRO_EXPAND8(__QX_MACRO_EXPAND8(__VA_ARGS__))
13
#define __QX_MACRO_EXPAND128(...) __QX_MACRO_EXPAND8(__QX_MACRO_EXPAND8(__VA_ARGS__))
14
#define __QX_MACRO_EXPAND256(...) __QX_MACRO_EXPAND8(__QX_MACRO_EXPAND8(__VA_ARGS__))
15
#define __QX_MACRO_EVALUATE(...) __QX_MACRO_EXPAND256(__VA_ARGS__)
16
17
#define __QX_MACRO_CALL ()
18
19
#define __QX_FOR_EACH_NEXT() __QX_FOR_EACH_APPLY_AND_ITERATE
20
#define __QX_FOR_EACH_NEXT_DELIM() __QX_FOR_EACH_APPLY_AND_ITERATE_DELIM
21
22
#define __QX_FOR_EACH_APPLY_AND_ITERATE(macro, first, ...) \
23
macro(first) \
24
__VA_OPT__(__QX_FOR_EACH_NEXT __QX_MACRO_CALL (macro, __VA_ARGS__))
25
26
#define __QX_FOR_EACH_APPLY_AND_ITERATE_DELIM(macro, first, ...) \
27
macro(first) \
28
__VA_OPT__(, __QX_FOR_EACH_NEXT_DELIM __QX_MACRO_CALL (macro, __VA_ARGS__))
31
// User
32
#define QX_SCOPED_ENUM_HASH_FUNC(T) \
33
inline size_t qHash(const T& t, size_t seed) { \
34
return ::qHash(static_cast<typename std::underlying_type<T>::type>(t), seed); \
35
}
36
37
#define QSL QStringLiteral
38
#define QBAL QByteArrayLiteral
39
40
#define QX_FOR_EACH(macro, ...) \
41
__VA_OPT__(__QX_MACRO_EVALUATE(__QX_FOR_EACH_APPLY_AND_ITERATE(macro, __VA_ARGS__)))
42
43
#define QX_FOR_EACH_DELIM(macro, ...) \
44
__VA_OPT__(__QX_MACRO_EVALUATE(__QX_FOR_EACH_APPLY_AND_ITERATE_DELIM(macro, __VA_ARGS__)))
45
46
#endif
// QX_MACROS_H
lib
utility
include
qx
utility
qx-macros.h
Generated by
1.10.0