diff options
Diffstat (limited to 'boost/contract/detail/preprocessor')
5 files changed, 171 insertions, 0 deletions
diff --git a/boost/contract/detail/preprocessor/keyword/private.hpp b/boost/contract/detail/preprocessor/keyword/private.hpp new file mode 100644 index 0000000000..2fc0d853f4 --- /dev/null +++ b/boost/contract/detail/preprocessor/keyword/private.hpp @@ -0,0 +1,35 @@ + +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_HPP_ + +// Copyright (C) 2008-2018 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 (see accompanying +// file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). +// See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html + +#include <boost/contract/detail/preprocessor/keyword/utility/is.hpp> +#include <boost/preprocessor/cat.hpp> + +/* PRIVATE */ + +// Must expand to a single comma `,` (not local macros, do not #undefine). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_CAT_TO_COMMAprivate , + +// Must expand to empty `` (not local macros, do not #undefine). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_CAT_TO_EMPTYprivate + +/* PUBLIC */ + +// Precondition: tokens must start with a token concatenable to a macro name +// (e.g., a literal or integral token). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PRIVATE(tokens) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_CAT_TO_COMMA, tokens) + +// Precondition: tokens must start with `private` (this can be +// checked with `..._IS_PRIVATE` macro above). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_PRIVATE(tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_PRIVATE_CAT_TO_EMPTY, tokens) + +#endif // #include guard + diff --git a/boost/contract/detail/preprocessor/keyword/protected.hpp b/boost/contract/detail/preprocessor/keyword/protected.hpp new file mode 100644 index 0000000000..e9ac94e78c --- /dev/null +++ b/boost/contract/detail/preprocessor/keyword/protected.hpp @@ -0,0 +1,36 @@ + +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_HPP_ + +// Copyright (C) 2008-2018 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 (see accompanying +// file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). +// See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html + +#include <boost/contract/detail/preprocessor/keyword/utility/is.hpp> +#include <boost/preprocessor/cat.hpp> + +/* PRIVATE */ + +// Must expand to a single comma `,` (not local macros, do not #undefine). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_CAT_TO_COMMAprotected , + +// Must expand to empty `` (not local macros, do not #undefine). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_CAT_TO_EMPTYprotected + +/* PUBLIC */ + +// Precondition: tokens must start with a token concatenable to a macro name +// (e.g., a literal or integral token). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PROTECTED(tokens) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_CAT_TO_COMMA, tokens) + +// Precondition: tokens must start with `protected` (this can be +// checked with `..._IS_PROTECTED` macro above). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_PROTECTED(tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_PROTECTED_CAT_TO_EMPTY, \ + tokens) + +#endif // #include guard + diff --git a/boost/contract/detail/preprocessor/keyword/public.hpp b/boost/contract/detail/preprocessor/keyword/public.hpp new file mode 100644 index 0000000000..b5e7994610 --- /dev/null +++ b/boost/contract/detail/preprocessor/keyword/public.hpp @@ -0,0 +1,35 @@ + +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_HPP_ + +// Copyright (C) 2008-2018 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 (see accompanying +// file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). +// See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html + +#include <boost/contract/detail/preprocessor/keyword/utility/is.hpp> +#include <boost/preprocessor/cat.hpp> + +/* PRIVATE */ + +// Must expand to a single comma `,` (not local macros, do not #undefine). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_CAT_TO_COMMApublic , + +// Must expand to empty `` (not local macros, do not #undefine). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_CAT_TO_EMPTYpublic + +/* PUBLIC */ + +// Precondition: tokens must start with a token concatenable to a macro name +// (e.g., a literal or integral token). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_PUBLIC(tokens) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_CAT_TO_COMMA, tokens) + +// Precondition: tokens must start with `public` (this can be +// checked with `..._IS_PUBLIC` macro above). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_PUBLIC(tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_PUBLIC_CAT_TO_EMPTY, tokens) + +#endif // #include guard + diff --git a/boost/contract/detail/preprocessor/keyword/utility/is.hpp b/boost/contract/detail/preprocessor/keyword/utility/is.hpp new file mode 100644 index 0000000000..d786033544 --- /dev/null +++ b/boost/contract/detail/preprocessor/keyword/utility/is.hpp @@ -0,0 +1,30 @@ + +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_HPP_ + +// Copyright (C) 2008-2018 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 (see accompanying +// file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). +// See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html + +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/variadic/size.hpp> + +/* PRIVATE */ + +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_1 0 +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_2 1 + +/* PUBLIC */ + +// Precondition: A macro named `cat_to_comma_prefix ## token-to-check` must be +// #defined to expand to `,`. +// Precondition: tokens must start with a token concatenable to a macro name +// (e.g., a literal or integral token). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + cat_to_comma_prefix, tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS_, \ + BOOST_PP_VARIADIC_SIZE(BOOST_PP_CAT(cat_to_comma_prefix, tokens))) + +#endif // #include guard + diff --git a/boost/contract/detail/preprocessor/keyword/virtual.hpp b/boost/contract/detail/preprocessor/keyword/virtual.hpp new file mode 100644 index 0000000000..2acfaa1de3 --- /dev/null +++ b/boost/contract/detail/preprocessor/keyword/virtual.hpp @@ -0,0 +1,35 @@ + +#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_HPP_ +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_HPP_ + +// Copyright (C) 2008-2018 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 (see accompanying +// file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). +// See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html + +#include <boost/contract/detail/preprocessor/keyword/utility/is.hpp> +#include <boost/preprocessor/cat.hpp> + +/* PRIVATE */ + +// Must expand to a single comma `,` (not local macros, do not #undefine). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_CAT_TO_COMMAvirtual , + +// Must expand to empty `` (not local macros, do not #undefine). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_CAT_TO_EMPTYvirtual + +/* PUBLIC */ + +// Precondition: tokens must start with a token concatenable to a macro name +// (e.g., a literal or integral token). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_VIRTUAL(tokens) \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_UTILITY_IS( \ + BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_CAT_TO_COMMA, tokens) + +// Precondition: tokens must start with `virtual` (this can be +// checked with `..._IS_VIRTUAL` macro above). +#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_REMOVE_VIRTUAL(tokens) \ + BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_KEYWORD_VIRTUAL_CAT_TO_EMPTY, tokens) + +#endif // #include guard + |