Chris@16: Chris@16: // (C) Copyright Edward Diener 2011,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_MEMBER_DATA_HPP) Chris@16: #define BOOST_TTI_HAS_MEMBER_DATA_HPP Chris@16: Chris@101: #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 data with a particular name and type exists. Chris@16: /** Chris@16: Chris@16: trait = the name of the metafunction. Chris@16: Chris@16: name = the name of the inner member to introspect. 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_ET = the enclosing type in which to look for our 'name' Chris@16: OR Chris@16: The type of the member data in the form of a pointer Chris@16: to member data. Chris@16: Chris@16: BOOST_TTI_TP_TYPE = (optional) The type of the member data if the first Chris@16: parameter is the enclosing type. Chris@16: Chris@16: returns = 'value' is true if the 'name' exists, with the correct data type, Chris@16: otherwise 'value' is false. Chris@16: Chris@16: */ Chris@16: #define BOOST_TTI_TRAIT_HAS_MEMBER_DATA(trait,name) \ Chris@16: BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \ Chris@16: template \ Chris@101: struct trait \ Chris@101: { \ Chris@101: typedef typename \ Chris@16: BOOST_PP_CAT(trait,_detail_hmd) \ Chris@101: < \ Chris@101: BOOST_TTI_TP_ET, \ Chris@101: BOOST_TTI_TP_TYPE \ Chris@101: >::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 data with a particular name and type exists. Chris@16: /** Chris@16: Chris@16: name = the name of the inner member. Chris@16: Chris@16: generates a metafunction called "has_member_data_name" where 'name' is the macro parameter. Chris@16: Chris@16: template Chris@16: struct has_member_data_name 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_ET = the enclosing type in which to look for our 'name' Chris@16: OR Chris@16: The type of the member data in the form of a pointer Chris@16: to member data. Chris@16: Chris@16: BOOST_TTI_TP_TYPE = (optional) The type of the member data if the first Chris@16: parameter is the enclosing type. Chris@16: Chris@16: returns = 'value' is true if the 'name' exists, with the correct data type, Chris@16: otherwise 'value' is false. Chris@16: Chris@16: */ Chris@16: #define BOOST_TTI_HAS_MEMBER_DATA(name) \ Chris@16: BOOST_TTI_TRAIT_HAS_MEMBER_DATA \ Chris@16: ( \ Chris@16: BOOST_TTI_HAS_MEMBER_DATA_GEN(name), \ Chris@16: name \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: #endif // BOOST_TTI_HAS_MEMBER_DATA_HPP