Chris@16: Chris@16: // (C) Copyright Edward Diener 2012,2013 Chris@16: // Use, modification and distribution are subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt). Chris@16: Chris@16: #if !defined(BOOST_TTI_HAS_FUNCTION_HPP) Chris@16: #define BOOST_TTI_HAS_FUNCTION_HPP Chris@16: Chris@101: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: /* Chris@16: Chris@16: The succeeding comments in this file are in doxygen format. Chris@16: Chris@16: */ Chris@16: Chris@16: /** \file Chris@16: */ Chris@16: Chris@16: /// Expands to a metafunction which tests whether a member function or a static member function with a particular name and signature exists. Chris@16: /** Chris@16: Chris@16: trait = the name of the metafunction within the tti namespace. Chris@16: Chris@16: name = the name of the inner member. Chris@16: Chris@16: generates a metafunction called "trait" where 'trait' is the macro parameter. Chris@16: Chris@16: template Chris@16: struct trait Chris@16: { Chris@16: static const value = unspecified; Chris@16: typedef mpl::bool_ type; Chris@16: }; Chris@16: Chris@16: The metafunction types and return: Chris@16: Chris@16: BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. Chris@16: Chris@16: BOOST_TTI_TP_R = the return type of the function Chris@16: Chris@16: BOOST_TTI_TP_FS = (optional) the parameters of the function as a boost::mpl forward sequence Chris@16: if function parameters are not empty. Chris@16: Chris@16: BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the function Chris@16: if the need for a tag exists. Chris@16: Chris@16: returns = 'value' is true if the 'name' exists, Chris@16: with the appropriate static member function type, Chris@16: otherwise 'value' is false. Chris@16: Chris@16: */ Chris@16: #define BOOST_TTI_TRAIT_HAS_FUNCTION(trait,name) \ Chris@16: BOOST_TTI_DETAIL_TRAIT_HAS_FUNCTION(trait,name) \ Chris@16: template,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \ Chris@101: struct trait \ Chris@16: { \ Chris@101: typedef typename \ Chris@101: BOOST_PP_CAT(trait,_detail_hf)::type type; \ Chris@101: BOOST_STATIC_CONSTANT(bool,value=type::value); \ Chris@16: }; \ Chris@16: /**/ Chris@16: Chris@16: /// Expands to a metafunction which tests whether a member function or a static member function with a particular name and signature exists. Chris@16: /** Chris@16: Chris@16: name = the name of the inner member. Chris@16: Chris@16: generates a metafunction called "has_function_name" where 'name' is the macro parameter. Chris@16: Chris@16: template Chris@16: struct trait Chris@16: { Chris@16: static const value = unspecified; Chris@16: typedef mpl::bool_ type; Chris@16: }; Chris@16: Chris@16: The metafunction types and return: Chris@16: Chris@16: BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. Chris@16: Chris@16: BOOST_TTI_TP_R = the return type of the function Chris@16: Chris@16: BOOST_TTI_TP_FS = (optional) the parameters of the function as a boost::mpl forward sequence Chris@16: if function parameters are not empty. Chris@16: Chris@16: BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the function Chris@16: if the need for a tag exists. Chris@16: Chris@16: returns = 'value' is true if the 'name' exists, Chris@16: with the appropriate function type, Chris@16: otherwise 'value' is false. Chris@16: Chris@16: */ Chris@16: #define BOOST_TTI_HAS_FUNCTION(name) \ Chris@16: BOOST_TTI_TRAIT_HAS_FUNCTION \ Chris@16: ( \ Chris@16: BOOST_TTI_HAS_FUNCTION_GEN(name), \ Chris@16: name \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: #endif // BOOST_TTI_HAS_FUNCTION_HPP