Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:55

0001 
0002 //  (C) Copyright Edward Diener 2011,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_MEMBER_FUNCTION_HPP)
0008 #define BOOST_TTI_HAS_MEMBER_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/ddeftype.hpp>
0015 #include <boost/tti/detail/dmem_fun.hpp>
0016 #include <boost/tti/gen/has_member_function_gen.hpp>
0017 #include <boost/tti/gen/namespace_gen.hpp>
0018 
0019 /*
0020 
0021   The succeeding comments in this file are in doxygen format.
0022 
0023 */
0024 
0025 /** \file
0026 */
0027 
0028 /// A macro which expands to a metafunction which tests whether a member function with a particular name and signature exists.
0029 /**
0030 
0031     BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION is a macro which expands to a metafunction.
0032     The metafunction tests whether a member function with a particular name
0033     and signature exists. The macro takes the form of BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(trait,name) where
0034     
0035     trait = the name of the metafunction <br/>
0036     name  = the name of the inner member.
0037 
0038     BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION generates a metafunction called "trait" where 'trait' is the macro parameter.
0039     
0040   @code
0041   
0042               template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG>
0043               struct trait
0044                 {
0045                 static const value = unspecified;
0046                 typedef mpl::bool_<true-or-false> type;
0047                 };
0048 
0049               The metafunction types and return:
0050     
0051                 BOOST_TTI_TP_T   = the enclosing type in which to look for our 'name'.
0052                                    The enclosing type can be a class, struct, or union.
0053                                             OR
0054                                    a pointer to member function as a single type.
0055                 
0056                 BOOST_TTI_TP_R   = (optional) the return type of the member function
0057                           if the first parameter is the enclosing type.
0058                 
0059                 BOOST_TTI_TP_FS  = (optional) the parameters of the member function as a boost::mpl forward sequence
0060                           if the first parameter is the enclosing type and the member function parameters
0061                           are not empty.
0062                 
0063                 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function
0064                           if the first parameter is the enclosing type and a tag is needed.
0065                 
0066                 returns = 'value' is true if the 'name' exists, 
0067                           with the appropriate member function type,
0068                           otherwise 'value' is false.
0069                           
0070   @endcode
0071   
0072 */
0073 #define BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(trait,name) \
0074   BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION(trait,name) \
0075   template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R = BOOST_TTI_NAMESPACE::detail::deftype,class BOOST_TTI_TP_FS = boost::mpl::vector<>,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \
0076   struct trait \
0077     { \
0078     typedef typename \
0079     BOOST_PP_CAT(trait,_detail_hmf)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \
0080     BOOST_STATIC_CONSTANT(bool,value=type::value); \
0081     }; \
0082 /**/
0083 
0084 /// A macro which expands to a metafunction which tests whether a member function with a particular name and signature exists.
0085 /**
0086 
0087     BOOST_TTI_HAS_MEMBER_FUNCTION is a macro which expands to a metafunction.
0088     The metafunction tests whether a member function with a particular name
0089     and signature exists. The macro takes the form of BOOST_TTI_HAS_MEMBER_FUNCTION(name) where
0090     
0091     name  = the name of the inner member.
0092 
0093     BOOST_TTI_HAS_MEMBER_FUNCTION generates a metafunction called "has_member_function_name" where 'name' is the macro parameter.
0094     
0095   @code
0096   
0097               template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
0098               struct has_member_function_'name'
0099                 {
0100                 static const value = unspecified;
0101                 typedef mpl::bool_<true-or-false> type;
0102                 };
0103 
0104               The metafunction types and return:
0105     
0106                 BOOST_TTI_TP_T   = the enclosing type in which to look for our 'name'.
0107                                    The enclosing type can be a class, struct, or union.
0108                                             OR
0109                                    a pointer to member function as a single type.
0110                 
0111                 BOOST_TTI_TP_R   = (optional) the return type of the member function
0112                           if the first parameter is the enclosing type.
0113                 
0114                 BOOST_TTI_TP_FS  = (optional) the parameters of the member function as a boost::mpl forward sequence
0115                           if the first parameter is the enclosing type and the member function parameters
0116                           are not empty.
0117                 
0118                 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function
0119                           if the first parameter is the enclosing type and a tag is needed.
0120                 
0121                 returns = 'value' is true if the 'name' exists, 
0122                           with the appropriate member function type,
0123                           otherwise 'value' is false.
0124                           
0125   @endcode
0126   
0127 */
0128 #define BOOST_TTI_HAS_MEMBER_FUNCTION(name) \
0129   BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION \
0130   ( \
0131   BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(name), \
0132   name \
0133   ) \
0134 /**/
0135 
0136 #endif // BOOST_TTI_HAS_MEMBER_FUNCTION_HPP