Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/local_function/detail/preprocessor/keyword/facility/is.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 
0002 // Copyright (C) 2009-2012 Lorenzo Caminiti
0003 // Distributed under the Boost Software License, Version 1.0
0004 // (see accompanying file LICENSE_1_0.txt or a copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 // Home at http://www.boost.org/libs/local_function
0007 
0008 #ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_HPP_
0009 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_HPP_
0010 
0011 // Boost.Preprocessor author P. Mensodines confirmed on an Boost email thread
0012 // (subject ``check if a token is a keyword (was "BOOST_PP_IS_UNARY()")'')
0013 // that it is OK to used `PP_IS_UNARY()` to check if tokens match predefined
0014 // "keyword" as it is done by the macros below (even if `PP_IS_UNARY()` is
0015 // technically only part of Boost.Preprocessor private API).
0016 #include <boost/preprocessor/detail/is_unary.hpp>
0017 #include <boost/preprocessor/cat.hpp>
0018 #include <boost/preprocessor/control/iif.hpp>
0019 #include <boost/preprocessor/tuple/eat.hpp>
0020 
0021 // PRIVATE //
0022 
0023 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_(a, b) \
0024     BOOST_PP_IS_UNARY(BOOST_PP_CAT(a, b))
0025 
0026 // PUBLIC //
0027 
0028 // `checking_prefix ## tokens` expand to unary (e.g., `(1)`) iff `tokens` start
0029 // with keyword to check.
0030 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT( \
0031         tokens, checking_prefix) \
0032     BOOST_PP_IIF(BOOST_PP_IS_UNARY(tokens), \
0033         /* on MSVC this check works even if tokens already unary but on */ \
0034         /* C++03 (including GCC) this check on non-unary tokens gives */ \
0035         /* a concatenation error -- so return false is tokens is not unary */ \
0036         0 BOOST_PP_TUPLE_EAT(2) \
0037     , \
0038         BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_ \
0039     )(checking_prefix, tokens)
0040 
0041 // `token ## checking_postfix` expand to unary (e.g., `(1)`) iff `token` is the
0042 // keyword to check. This check only works if `token` is a single token, it
0043 // will always expand to 0 if token is multiple tokens (e.g., `const *this`).
0044 // This check will expand to 0 with no error if `token` starts with a
0045 // non-alphanumeric symbol (e.g., `*this`).
0046 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_BACK( \
0047         token, checking_postfix) \
0048     BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_(token, checking_postfix)
0049 
0050 #endif // #include guard
0051