uSCXML 2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
Common.h
Go to the documentation of this file.
1
20
#ifndef COMMON_H_YZ3CIYP
21
#define COMMON_H_YZ3CIYP
22
23
#if __cplusplus >= 201402L
24
#define DEPRECATED [[deprecated]]
25
#elif defined(__GNUC__)
26
#define DEPRECATED __attribute__((deprecated))
27
#elif defined(_MSC_VER)
28
#define DEPRECATED __declspec(deprecated)
29
#else
30
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
31
#define DEPRECATED(alternative)
32
#endif
33
34
#if defined(_WIN32) && !defined(USCXML_STATIC)
35
# ifdef USCXML_EXPORT
36
# define USCXML_API __declspec(dllexport)
37
# else
38
# define USCXML_API __declspec(dllimport)
39
# endif
40
#else
41
# define USCXML_API
42
#endif
43
44
#ifdef _WIN32
45
typedef
unsigned
__int32 uint32_t;
46
47
// see http://stackoverflow.com/questions/1372480/c-redefinition-header-files
48
#define _WINSOCKAPI_ // stops windows.h including winsock.h
49
#include <winsock2.h>
50
#define WIN32_LEAN_AND_MEAN
51
#include <windows.h>
52
#undef WIN32_LEAN_AND_MEAN
53
#else
54
#include <sys/socket.h>
55
#endif
56
60
#define PIMPL_OPERATORS(type) \
61
type() : _impl() { } \
62
type(const std::shared_ptr<type##Impl> impl) : _impl(impl) { }\
63
type(const type& other) : _impl(other._impl) { }\
64
virtual ~type() { };\
65
\
66
operator bool() const {\
67
return !!_impl;\
68
}\
69
bool operator< (const type& other) const {\
70
return _impl < other._impl;\
71
}\
72
bool operator==(const type& other) const {\
73
return _impl == other._impl;\
74
}\
75
bool operator!=(const type& other) const {\
76
return _impl != other._impl;\
77
}\
78
type& operator= (const type& other) {\
79
_impl = other._impl;\
80
return *this;\
81
}
82
83
#define PIMPL_OPERATORS_INHERIT(type, base) \
84
type() : _impl() {}\
85
type(std::shared_ptr<type##Impl> const impl);\
86
type(const type& other);\
87
virtual ~type() {};\
88
\
89
operator bool() const {\
90
return !!_impl;\
91
}\
92
bool operator< (const type& other) const {\
93
return _impl < other._impl;\
94
}\
95
bool operator==(const type& other) const {\
96
return _impl == other._impl;\
97
}\
98
bool operator!=(const type& other) const {\
99
return _impl != other._impl;\
100
}\
101
type& operator= (const type& other);
102
103
104
#define PIMPL_OPERATORS_INHERIT_IMPL(type, base) \
105
type::type(std::shared_ptr<type##Impl> const impl) : base(impl), _impl(impl) { }\
106
type::type(const type& other) : base(other._impl), _impl(other._impl) { }\
107
type& type::operator= (const type& other) {\
108
_impl = other._impl;\
109
base::_impl = _impl;\
110
return *this;\
111
}
112
113
114
#if defined(_WIN32)
115
inline
int
setenv(
const
char
*name,
const
char
*value,
int
overwrite) {
116
int
errcode = 0;
117
if
(!overwrite) {
118
size_t
envsize = 0;
119
errcode = getenv_s(&envsize, NULL, 0, name);
120
if
(errcode || envsize)
return
errcode;
121
}
122
return
_putenv_s(name, value);
123
}
124
#endif
125
126
#define _USE_MATH_DEFINES
127
#include <cmath>
128
129
#if defined(_MSC_VER)
130
// disable signed / unsigned comparison warnings
131
#pragma warning (disable : 4018)
132
// possible loss of data
133
#pragma warning (disable : 4244)
134
#pragma warning (disable : 4267)
135
// 'this' : used in base member initializer list
136
#pragma warning (disable : 4355)
137
138
// is thrown alot in arabica headers
139
#pragma warning (disable : 4240)
140
#pragma warning (disable : 4250)
141
#pragma warning (disable : 4661)
142
143
// dll interface
144
#pragma warning (disable : 4251)
145
146
#endif
147
148
149
#endif
/* end of include guard: COMMON_H_YZ3CIYP */