Go to the documentation of this file.
10 #ifndef MSGPACK_VERSIONING_HPP
11 #define MSGPACK_VERSIONING_HPP
13 #if !defined(MSGPACK_DEFAULT_API_VERSION)
14 #define MSGPACK_DEFAULT_API_VERSION 1
17 #define MSGPACK_DEFAULT_API_NS MSGPACK_DETAIL_PP_CAT(v, MSGPACK_DEFAULT_API_VERSION)
19 #if MSGPACK_DEFAULT_API_VERSION == 1
20 #define MSGPACK_DETAIL_PP_ENABLE_NS_v1 ()
27 #define MSGPACK_DETAIL_PP_CAT(a, ...) MSGPACK_DETAIL_PP_PRIMITIVE_CAT(a, __VA_ARGS__)
28 #define MSGPACK_DETAIL_PP_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
30 #define MSGPACK_DETAIL_PP_IIF(c) MSGPACK_DETAIL_PP_PRIMITIVE_CAT(MSGPACK_DETAIL_PP_IIF_, c)
31 #define MSGPACK_DETAIL_PP_IIF_0(t, ...) __VA_ARGS__
32 #define MSGPACK_DETAIL_PP_IIF_1(t, ...) t
34 #define MSGPACK_DETAIL_PP_PROBE(x) x, 1
38 #define MSGPACK_DETAIL_PP_MSVC_VA_ARGS_WORKAROUND(define, args) define args
39 #define MSGPACK_DETAIL_PP_CHECK(...) MSGPACK_DETAIL_PP_MSVC_VA_ARGS_WORKAROUND(MSGPACK_DETAIL_PP_CHECK_N, (__VA_ARGS__, 0))
40 #define MSGPACK_DETAIL_PP_CHECK_N(x, n, ...) n
42 #else // defined(__MSC_VER)
44 #define MSGPACK_DETAIL_PP_CHECK(...) MSGPACK_DETAIL_PP_CHECK_N(__VA_ARGS__, 0)
45 #define MSGPACK_DETAIL_PP_CHECK_N(x, n, ...) n
47 #endif // defined(__MSC_VER)
50 #define MSGPACK_DETAIL_PP_NS_ENABLED_PROBE(ns) MSGPACK_DETAIL_PP_NS_ENABLED_PROBE_PROXY( MSGPACK_DETAIL_PP_ENABLE_NS_##ns )
51 #define MSGPACK_DETAIL_PP_NS_ENABLED_PROBE_PROXY(...) MSGPACK_DETAIL_PP_NS_ENABLED_PROBE_PRIMIVIE(__VA_ARGS__)
52 #define MSGPACK_DETAIL_PP_NS_ENABLED_PROBE_PRIMIVIE(x) MSGPACK_DETAIL_PP_NS_ENABLED_PROBE_COMBINE_ x
53 #define MSGPACK_DETAIL_PP_NS_ENABLED_PROBE_COMBINE_(...) MSGPACK_DETAIL_PP_PROBE(~)
55 #define MSGPACK_DETAIL_PP_IS_NS_ENABLED(ns) MSGPACK_DETAIL_PP_CHECK(MSGPACK_DETAIL_PP_NS_ENABLED_PROBE(ns))
57 #if __cplusplus < 201103L
58 #define MSGPACK_API_VERSION_NAMESPACE(ns) MSGPACK_DETAIL_PP_IIF(MSGPACK_DETAIL_PP_IS_NS_ENABLED(ns)) \
59 (namespace ns{}; using namespace ns; namespace ns, \
62 #else // __cplusplus < 201103L
64 #define MSGPACK_API_VERSION_NAMESPACE(ns) MSGPACK_DETAIL_PP_IIF(MSGPACK_DETAIL_PP_IS_NS_ENABLED(ns)) \
65 (inline namespace ns, namespace ns)
67 #endif // __cplusplus < 201103L
69 #endif // MSGPACK_VERSIONING_HPP