Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:26

0001 
0002 #ifndef BOOST_CONTRACT_DETAIL_DECL_HPP_
0003 #define BOOST_CONTRACT_DETAIL_DECL_HPP_
0004 
0005 // Copyright (C) 2008-2018 Lorenzo Caminiti
0006 // Distributed under the Boost Software License, Version 1.0 (see accompanying
0007 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
0008 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
0009 
0010 // Cannot include core/*.hpp other than config.hpp here (avoid circular incl).
0011 #include <boost/contract/detail/tvariadic.hpp>
0012 #if !BOOST_CONTRACT_DETAIL_TVARIADIC
0013     #include <boost/contract/core/config.hpp>
0014     #include <boost/preprocessor/repetition/repeat.hpp>
0015     #include <boost/preprocessor/tuple/elem.hpp>
0016     #include <boost/preprocessor/arithmetic/inc.hpp>
0017 #endif
0018 #include <boost/preprocessor/control/expr_iif.hpp>
0019 #include <boost/preprocessor/control/iif.hpp>
0020 #include <boost/preprocessor/punctuation/comma_if.hpp>
0021 
0022 /* PUBLIC */
0023 
0024 #define BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \
0025     arity, is_friend, has_result, \
0026     O, VR, F, C, Args, \
0027     v, r, f, obj, args \
0028 ) \
0029     template< \
0030         class O \
0031         BOOST_PP_COMMA_IF(has_result) \
0032         BOOST_PP_EXPR_IIF(has_result, typename VR) \
0033         , typename F \
0034         , class C \
0035         BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \
0036         BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(z, arity, Args) \
0037     > \
0038     BOOST_PP_EXPR_IIF(is_friend, friend) \
0039     boost::contract::specify_precondition_old_postcondition_except< \
0040             BOOST_PP_EXPR_IIF(has_result, VR)> \
0041     /* no boost::contract:: here for friends (otherwise need fwd decl) */ \
0042     public_function( \
0043         boost::contract::virtual_* v \
0044         BOOST_PP_COMMA_IF(has_result) \
0045         BOOST_PP_EXPR_IIF(has_result, VR& r) \
0046         , F f \
0047         , C* obj \
0048         BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(arity) \
0049         BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(z, arity, Args, &, args) \
0050     )
0051 
0052 #if BOOST_CONTRACT_DETAIL_TVARIADIC
0053     #define BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(z, \
0054         O, VR, F, C, Args, \
0055         v, r, f, obj, args \
0056     ) \
0057         BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \
0058             ~, /* is_friend = */ 1, /* has_result = */ 0, \
0059             O, VR, F, C, Args, v, r, f, obj, args \
0060         ); \
0061         BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \
0062             ~, /* is_friend = */ 1, /* has_result = */ 1, \
0063             O, VR, F, C, Args, v, r, f, obj, args \
0064         );
0065 #else
0066     /* PRIVATE */
0067     #define BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_( \
0068             z, n, result_O_R_F_C_Args_v_r_f_obj_args) \
0069         BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \
0070             /* arity = */ n, \
0071             /* is_friend = */ 1, \
0072             BOOST_PP_TUPLE_ELEM(11, 0, result_O_R_F_C_Args_v_r_f_obj_args), \
0073             BOOST_PP_TUPLE_ELEM(11, 1, result_O_R_F_C_Args_v_r_f_obj_args), \
0074             BOOST_PP_TUPLE_ELEM(11, 2, result_O_R_F_C_Args_v_r_f_obj_args), \
0075             BOOST_PP_TUPLE_ELEM(11, 3, result_O_R_F_C_Args_v_r_f_obj_args), \
0076             BOOST_PP_TUPLE_ELEM(11, 4, result_O_R_F_C_Args_v_r_f_obj_args), \
0077             BOOST_PP_TUPLE_ELEM(11, 5, result_O_R_F_C_Args_v_r_f_obj_args), \
0078             BOOST_PP_TUPLE_ELEM(11, 6, result_O_R_F_C_Args_v_r_f_obj_args), \
0079             BOOST_PP_TUPLE_ELEM(11, 7, result_O_R_F_C_Args_v_r_f_obj_args), \
0080             BOOST_PP_TUPLE_ELEM(11, 8, result_O_R_F_C_Args_v_r_f_obj_args), \
0081             BOOST_PP_TUPLE_ELEM(11, 9, result_O_R_F_C_Args_v_r_f_obj_args), \
0082             BOOST_PP_TUPLE_ELEM(11, 10, result_O_R_F_C_Args_v_r_f_obj_args) \
0083         );
0084 
0085     /* PUBLIC */
0086     #define BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(z, \
0087         O, VR, F, C, Args, \
0088         v, r, f, obj, args \
0089     ) \
0090         BOOST_PP_REPEAT_ ## z( \
0091             BOOST_PP_INC(BOOST_CONTRACT_MAX_ARGS), \
0092             BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_, \
0093             (/* has_result = */ 0, O, VR, F, C, Args, v, r, f, obj, args) \
0094         ) \
0095         BOOST_PP_REPEAT_ ## z( \
0096             BOOST_PP_INC(BOOST_CONTRACT_MAX_ARGS), \
0097             BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTION_, \
0098             (/* has_result = */ 1, O, VR, F, C, Args, v, r, f, obj, args) \
0099         )
0100 #endif
0101 
0102 #define BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z( \
0103         z, is_friend, O, VR, F, C, Args) \
0104     template< \
0105         class O, typename VR, typename F, class C \
0106         BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) \
0107         BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(z, \
0108                 BOOST_CONTRACT_MAX_ARGS, Args) \
0109     > \
0110     BOOST_PP_IIF(is_friend, \
0111         friend class boost::contract::detail:: \
0112     , \
0113         class \
0114     ) \
0115     cond_subcontracting
0116 
0117 /* CODE */
0118 
0119 namespace boost {
0120     namespace contract {
0121         class virtual_;
0122 
0123         template<typename VR = void>
0124         class specify_precondition_old_postcondition_except;
0125     }
0126 }
0127     
0128 #endif // #include guard
0129