|
||||
File indexing completed on 2025-01-30 10:01:20
0001 0002 // (C) Copyright Edward Diener 2012,2013 0003 // Use, modification and distribution are subject to the Boost Software License, 0004 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 0005 // http://www.boost.org/LICENSE_1_0.txt). 0006 0007 #if !defined(BOOST_TTI_HAS_FUNCTION_HPP) 0008 #define BOOST_TTI_HAS_FUNCTION_HPP 0009 0010 #include <boost/config.hpp> 0011 #include <boost/function_types/property_tags.hpp> 0012 #include <boost/mpl/vector.hpp> 0013 #include <boost/preprocessor/cat.hpp> 0014 #include <boost/tti/detail/dfunction.hpp> 0015 #include <boost/tti/gen/has_function_gen.hpp> 0016 0017 /* 0018 0019 The succeeding comments in this file are in doxygen format. 0020 0021 */ 0022 0023 /** \file 0024 */ 0025 0026 /// A macro which expands to a metafunction which tests whether a member function or a static member function with a particular name and signature exists. 0027 /** 0028 0029 BOOST_TTI_TRAIT_HAS_FUNCTION is a macro which expands to a metafunction. 0030 The metafunction tests whether a member function or a static member function with a particular name 0031 and signature exists. The macro takes the form of BOOST_TTI_TRAIT_HAS_FUNCTION(trait,name) where 0032 0033 trait = the name of the metafunction <br/> 0034 name = the name of the inner member. 0035 0036 BOOST_TTI_TRAIT_HAS_FUNCTION generates a metafunction called "trait" where 'trait' is the macro parameter. 0037 0038 @code 0039 0040 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG> 0041 struct trait 0042 { 0043 static const value = unspecified; 0044 typedef mpl::bool_<true-or-false> type; 0045 }; 0046 0047 The metafunction types and return: 0048 0049 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. 0050 The enclosing type can be a class, struct, or union. 0051 0052 BOOST_TTI_TP_R = the return type of the function 0053 0054 BOOST_TTI_TP_FS = (optional) the parameters of the function as a boost::mpl forward sequence 0055 if function parameters are not empty. 0056 0057 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the function 0058 if the need for a tag exists. 0059 0060 returns = 'value' is true if the 'name' exists, 0061 with the appropriate static member function type, 0062 otherwise 'value' is false. 0063 0064 @endcode 0065 0066 */ 0067 #define BOOST_TTI_TRAIT_HAS_FUNCTION(trait,name) \ 0068 BOOST_TTI_DETAIL_TRAIT_HAS_FUNCTION(trait,name) \ 0069 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS = boost::mpl::vector<>,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \ 0070 struct trait \ 0071 { \ 0072 typedef typename \ 0073 BOOST_PP_CAT(trait,_detail_hf)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \ 0074 BOOST_STATIC_CONSTANT(bool,value=type::value); \ 0075 }; \ 0076 /**/ 0077 0078 /// A macro which expands to a metafunction which tests whether a member function or a static member function with a particular name and signature exists. 0079 /** 0080 0081 BOOST_TTI_HAS_FUNCTION is a macro which expands to a metafunction. 0082 The metafunction tests whether a member function or a static member function with a particular name 0083 and signature exists. The macro takes the form of BOOST_TTI_HAS_FUNCTION(name) where 0084 0085 name = the name of the inner member. 0086 0087 BOOST_TTI_HAS_FUNCTION generates a metafunction called "has_function_name" where 'name' is the macro parameter. 0088 0089 @code 0090 0091 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG> 0092 struct has_function_'name' 0093 { 0094 static const value = unspecified; 0095 typedef mpl::bool_<true-or-false> type; 0096 }; 0097 0098 The metafunction types and return: 0099 0100 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. 0101 The enclosing type can be a class, struct, or union. 0102 0103 BOOST_TTI_TP_R = the return type of the function 0104 0105 BOOST_TTI_TP_FS = (optional) the parameters of the function as a boost::mpl forward sequence 0106 if function parameters are not empty. 0107 0108 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the function 0109 if the need for a tag exists. 0110 0111 returns = 'value' is true if the 'name' exists, 0112 with the appropriate function type, 0113 otherwise 'value' is false. 0114 0115 @endcode 0116 0117 */ 0118 #define BOOST_TTI_HAS_FUNCTION(name) \ 0119 BOOST_TTI_TRAIT_HAS_FUNCTION \ 0120 ( \ 0121 BOOST_TTI_HAS_FUNCTION_GEN(name), \ 0122 name \ 0123 ) \ 0124 /**/ 0125 0126 #endif // BOOST_TTI_HAS_FUNCTION_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |