C++ Utilities
4.6.1
Common C++ classes and routines used by my applications such as argument parser, IO and conversion utilities
application
global.h
Go to the documentation of this file.
1
#ifndef APPLICATION_UTILITIES_GLOBAL_H
2
#define APPLICATION_UTILITIES_GLOBAL_H
3
4
#if defined(_WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
5
# ifndef PLATFORM_WINDOWS
6
# define PLATFORM_WINDOWS
8
# endif
9
#endif
10
#if defined(__CYGWIN__)
11
# ifndef PLATFORM_CYGWIN
12
# define PLATFORM_CYGWIN
14
# endif
15
#endif
16
# if defined(__MINGW32__) || defined(__MINGW64__)
17
# ifndef PLATFORM_MINGW
18
# define PLATFORM_MINGW
20
# endif
21
# endif
22
#if defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
23
# ifndef PLATFORM_LINUX
24
# define PLATFORM_LINUX
26
# endif
27
# if defined(__ANDROID__) || defined(ANDROID)
28
# ifndef PLATFORM_ANDROID
29
# define PLATFORM_ANDROID
31
# endif
32
# endif
33
#endif
34
#if defined(__APPLE__)
35
# include <TargetConditionals.h>
36
# if defined(TARGET_OS_MAC) && TARGET_OS_MAC
37
# ifndef PLATFORM_MAC
38
# define PLATFORM_MAC
40
# endif
41
# ifndef PLATFORM_BSD4
42
# define PLATFORM_BSD4
44
# endif
45
# endif
46
#endif
47
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
48
# ifndef PLATFORM_FREE_BSD
49
# define PLATFORM_FREE_BSD
51
# endif
52
#endif
53
#if defined(__unix__) || defined(PLATFORM_LINUX) || defined(PLATFORM_FREE_BSD) || defined(PLATFORM_MAC)
54
# ifndef PLATFORM_UNIX
55
# define PLATFORM_UNIX
57
# endif
58
#endif
59
77
#ifdef PLATFORM_WINDOWS
78
# define LIB_EXPORT __declspec(dllexport)
79
# define LIB_IMPORT __declspec(dllimport)
80
# define LIB_HIDDEN
81
#else
82
# define LIB_EXPORT __attribute__((visibility("default")))
83
# define LIB_IMPORT __attribute__((visibility("default")))
84
# define LIB_HIDDEN __attribute__((visibility("hidden")))
85
#endif
86
93
#ifndef USE_NOTHROW
94
# if __cplusplus >= 201103L
95
# define USE_NOTHROW noexcept
96
# else
97
# define USE_NOTHROW throw()
98
# endif
99
#endif
100
106
#define DECLARE_ENUM(name, base) enum name : base
107
113
#define DECLARE_ENUM_CLASS(name, base) enum class name : base
114
120
#define VAR_UNUSED(x) (void)x;
121
127
#ifdef DEBUG_BUILD
128
# define IF_DEBUG_BUILD(x) x
129
#else
130
# define IF_DEBUG_BUILD(x)
131
#endif
132
139
#ifdef __clang__
140
# define FALLTHROUGH [[clang::fallthrough]]
141
# else
142
# define FALLTHROUGH
143
#endif
144
145
#endif // APPLICATION_UTILITIES_GLOBAL_H
Generated on Wed Mar 22 2017 17:09:17 for C++ Utilities by
1.8.13