12 #include "aegis/version.hpp"
13 #include "aegis/fwd.hpp"
15 #if !defined(ASIO_NO_DEPRECATED)
16 #define ASIO_NO_DEPRECATED
19 #if !defined(ASIO_STANDALONE)
20 #define ASIO_STANDALONE
23 #if !defined(ASIO_HEADER_ONLY) && !defined(ASIO_DYN_LINK) && !defined(ASIO_SEPARATE_COMPILATION)
24 #define ASIO_HEADER_ONLY
27 #if !defined(_WEBSOCKETPP_CPP11_STL_)
28 #define _WEBSOCKETPP_CPP11_STL_
36 #if !defined(AEGIS_HEADER_ONLY)
37 # if !defined(AEGIS_SEPARATE_COMPILATION)
38 # if !defined(AEGIS_DYN_LINK)
39 # define AEGIS_HEADER_ONLY 1
40 # endif // !defined(AEGIS_DYN_LINK)
41 # endif // !defined(AEGIS_SEPARATE_COMPILATION)
42 #endif // !defined(AEGIS_HEADER_ONLY)
44 #if defined(AEGIS_HEADER_ONLY)
45 # define AEGIS_DECL inline
46 #else // defined(AEGIS_HEADER_ONLY)
47 # if defined(_MSC_VER)
50 # if defined(AEGIS_DYN_LINK)
52 # if defined(AEGIS_SOURCE)
53 # define AEGIS_DECL __declspec(dllexport)
54 # else // defined(AEGIS_SOURCE)
55 # define AEGIS_DECL __declspec(dllimport)
56 # endif // defined(AEGIS_SOURCE)
57 # endif // defined(AEGIS_DYN_LINK)
58 # endif // defined(_MSC_VER)
59 #endif // defined(AEGIS_HEADER_ONLY)
62 #if !defined(AEGIS_DECL)
64 #endif // !defined(AEGIS_DECL)
67 #if !defined(AEGIS_MSVC)
68 # if defined(_MSC_VER) && (defined(__INTELLISENSE__) \
69 || (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
70 # define AEGIS_MSVC _MSC_VER
71 # endif // defined(_MSC_VER) && defined(__INTELLISENSE__)
73 #endif // defined(AEGIS_MSVC)
74 #if defined(AEGIS_MSVC)
76 #endif // defined(AEGIS_MSVC)
79 #if defined(AEGIS_MSVC)
80 # if (_MSVC_LANG < 201402)
81 # error AegisLib requires C++14 or greater
84 # if (__cplusplus < 201402)
85 # error AegisLib requires C++14 or greater
89 #if (__cplusplus >= 201703) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703) || (defined(_HAS_CXX17) && _HAS_CXX17 != 0)
91 #endif // (__cplusplus >= 201703) || (_MSVC_LANG >= 201703)
94 #if !defined(AEGIS_HAS_STD_OPTIONAL)
95 # if (__cplusplus >= 201703)
96 # if __has_include(<optional>)
100 template<
typename T>
using optional = std::optional<T>;
101 constexpr
auto nullopt = std::nullopt;
102 using bad_optional_access = std::bad_optional_access;
104 # define AEGIS_HAS_STD_OPTIONAL 1
105 # elif __has_include(<experimental/optional>)
106 # include <experimental/optional>
109 template<
typename T>
using optional = std::experimental::optional<T>;
110 constexpr
auto nullopt = std::experimental::nullopt;
111 using bad_optional_access = std::experimental::bad_optional_access;
113 # define AEGIS_HAS_STD_OPTIONAL 1
114 # endif // __has_include(<optional>)
115 # elif (__cplusplus >= 201402) // c++14
116 # include "aegis/optional.hpp"
121 template<
typename T>
using optional = std::experimental::optional<T>;
122 constexpr
auto nullopt = std::experimental::nullopt;
123 using bad_optional_access = std::experimental::bad_optional_access;
126 # define AEGIS_HAS_STD_OPTIONAL 1
127 # define AEGIS_HAS_BUILTIN_OPTIONAL 1
128 # endif // (__cplusplus >= 201703)
129 # if defined(AEGIS_MSVC)
130 # if (_MSVC_LANG < 201703)
131 # include "aegis/optional.hpp"
136 template<
typename T>
using optional = std::experimental::optional<T>;
137 constexpr
auto nullopt = std::experimental::nullopt;
138 using bad_optional_access = std::experimental::bad_optional_access;
141 # define AEGIS_HAS_STD_OPTIONAL 1
142 # define AEGIS_HAS_BUILTIN_OPTIONAL 1
147 template<
typename T>
using optional = std::optional<T>;
148 constexpr
auto nullopt = std::nullopt;
149 using bad_optional_access = std::bad_optional_access;
151 # define AEGIS_HAS_STD_OPTIONAL 1
152 # endif // (_MSC_VER >= 1910 && _HAS_CXX17)
153 # endif // defined(AEGIS_MSVC)
154 #endif // !defined(AEGIS_HAS_STD_OPTIONAL)
156 #if !defined(AEGIS_HAS_STD_OPTIONAL)
157 # error Could not find a suitable optional library.
161 #if !defined(AEGIS_HAS_STD_SHARED_MUTEX)
162 # if !defined(AEGIS_DISABLE_STD_SHARED_MUTEX)
163 # if (__cplusplus >= 201703) || (_MSVC_LANG >= 201703)
164 # define AEGIS_HAS_STD_SHARED_MUTEX 1
165 # endif // (__cplusplus >= 201703) || (_MSVC_LANG >= 201703)
166 # endif // !defined(AEGIS_DISABLE_STD_SHARED_MUTEX)
167 # if !defined(AEGIS_HAS_STD_SHARED_MUTEX)
168 # define AEGIS_HAS_STD_SHARED_MUTEX 0
169 # endif // !defined(AEGIS_HAS_STD_SHARED_MUTEX)
170 #endif // !defined(AEGIS_HAS_STD_SHARED_MUTEX)
177 #if defined(DEBUG) || defined(_DEBUG)
178 #define AEGIS_DEBUG(logger, ...) if (logger->should_log(spdlog::level::level_enum::debug)) logger->debug(__VA_ARGS__)
179 #define SPDLOG_STR_H(x) #x
180 #define SPDLOG_STR_HELPER(x) SPDLOG_STR_H(x)
182 #define AEGIS_TRACE(logger, ...) if (logger->should_log(spdlog::level::level_enum::trace)) logger->trace("[ " __FILE__ "(" SPDLOG_STR_HELPER(__LINE__) ") ] " __VA_ARGS__)
184 #define AEGIS_TRACE(logger, ...) if (logger->should_log(spdlog::level::level_enum::trace)) logger->trace("[ " __FILE__ ":" SPDLOG_STR_HELPER(__LINE__) " ] " __VA_ARGS__)
188 #define AEGIS_DEBUG(logger, ...) (void)0
189 #define AEGIS_TRACE(logger, ...) (void)0