Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:40

0001 #ifndef BOOST_DESCRIBE_CLASS_HPP_INCLUDED
0002 #define BOOST_DESCRIBE_CLASS_HPP_INCLUDED
0003 
0004 // Copyright 2020 Peter Dimov
0005 // Distributed under the Boost Software License, Version 1.0.
0006 // https://www.boost.org/LICENSE_1_0.txt
0007 
0008 #include <boost/describe/detail/config.hpp>
0009 
0010 #if !defined(BOOST_DESCRIBE_CXX14)
0011 
0012 #define BOOST_DESCRIBE_CLASS(C, Bases, Public, Protected, Private)
0013 #define BOOST_DESCRIBE_STRUCT(C, Bases, Members)
0014 
0015 #else
0016 
0017 #include <boost/describe/detail/bases.hpp>
0018 #include <boost/describe/detail/members.hpp>
0019 #include <type_traits>
0020 
0021 namespace boost
0022 {
0023 namespace describe
0024 {
0025 
0026 #if defined(_MSC_VER) && !defined(__clang__)
0027 
0028 #define BOOST_DESCRIBE_PP_UNPACK(...) __VA_ARGS__
0029 
0030 #define BOOST_DESCRIBE_CLASS(C, Bases, Public, Protected, Private) \
0031     friend BOOST_DESCRIBE_BASES(C, BOOST_DESCRIBE_PP_UNPACK Bases) \
0032     friend BOOST_DESCRIBE_PUBLIC_MEMBERS(C, BOOST_DESCRIBE_PP_UNPACK Public) \
0033     friend BOOST_DESCRIBE_PROTECTED_MEMBERS(C, BOOST_DESCRIBE_PP_UNPACK Protected) \
0034     friend BOOST_DESCRIBE_PRIVATE_MEMBERS(C, BOOST_DESCRIBE_PP_UNPACK Private)
0035 
0036 #define BOOST_DESCRIBE_STRUCT(C, Bases, Members) \
0037     static_assert(std::is_class<C>::value || std::is_union<C>::value, "BOOST_DESCRIBE_STRUCT should only be used with class types"); \
0038     BOOST_DESCRIBE_BASES(C, BOOST_DESCRIBE_PP_UNPACK Bases) \
0039     BOOST_DESCRIBE_PUBLIC_MEMBERS(C, BOOST_DESCRIBE_PP_UNPACK Members) \
0040     BOOST_DESCRIBE_PROTECTED_MEMBERS(C) \
0041     BOOST_DESCRIBE_PRIVATE_MEMBERS(C)
0042 
0043 #else
0044 
0045 #if defined(__GNUC__) && __GNUC__ >= 8
0046 # define BOOST_DESCRIBE_PP_UNPACK(...) __VA_OPT__(,) __VA_ARGS__
0047 #else
0048 # define BOOST_DESCRIBE_PP_UNPACK(...) , ##__VA_ARGS__
0049 #endif
0050 
0051 #define BOOST_DESCRIBE_BASES_(...) BOOST_DESCRIBE_BASES(__VA_ARGS__)
0052 #define BOOST_DESCRIBE_PUBLIC_MEMBERS_(...) BOOST_DESCRIBE_PUBLIC_MEMBERS(__VA_ARGS__)
0053 #define BOOST_DESCRIBE_PROTECTED_MEMBERS_(...) BOOST_DESCRIBE_PROTECTED_MEMBERS(__VA_ARGS__)
0054 #define BOOST_DESCRIBE_PRIVATE_MEMBERS_(...) BOOST_DESCRIBE_PRIVATE_MEMBERS(__VA_ARGS__)
0055 
0056 #define BOOST_DESCRIBE_CLASS(C, Bases, Public, Protected, Private) \
0057     BOOST_DESCRIBE_MAYBE_UNUSED friend BOOST_DESCRIBE_BASES_(C BOOST_DESCRIBE_PP_UNPACK Bases) \
0058     BOOST_DESCRIBE_MAYBE_UNUSED friend BOOST_DESCRIBE_PUBLIC_MEMBERS_(C BOOST_DESCRIBE_PP_UNPACK Public) \
0059     BOOST_DESCRIBE_MAYBE_UNUSED friend BOOST_DESCRIBE_PROTECTED_MEMBERS_(C BOOST_DESCRIBE_PP_UNPACK Protected) \
0060     BOOST_DESCRIBE_MAYBE_UNUSED friend BOOST_DESCRIBE_PRIVATE_MEMBERS_(C BOOST_DESCRIBE_PP_UNPACK Private)
0061 
0062 #define BOOST_DESCRIBE_STRUCT(C, Bases, Members) \
0063     static_assert(std::is_class<C>::value || std::is_union<C>::value, "BOOST_DESCRIBE_STRUCT should only be used with class types"); \
0064     BOOST_DESCRIBE_MAYBE_UNUSED BOOST_DESCRIBE_BASES_(C BOOST_DESCRIBE_PP_UNPACK Bases) \
0065     BOOST_DESCRIBE_MAYBE_UNUSED BOOST_DESCRIBE_PUBLIC_MEMBERS_(C BOOST_DESCRIBE_PP_UNPACK Members) \
0066     BOOST_DESCRIBE_MAYBE_UNUSED BOOST_DESCRIBE_PROTECTED_MEMBERS_(C) \
0067     BOOST_DESCRIBE_MAYBE_UNUSED BOOST_DESCRIBE_PRIVATE_MEMBERS_(C)
0068 
0069 #endif
0070 
0071 } // namespace describe
0072 } // namespace boost
0073 
0074 #endif // !defined(BOOST_DESCRIBE_CXX14)
0075 
0076 #endif // #ifndef BOOST_DESCRIBE_CLASS_HPP_INCLUDED