Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //  (C) Copyright Gennadiy Rozental 2001.
0002 //  Use, modification, and distribution are subject to the
0003 //  Boost Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 //  See http://www.boost.org/libs/test for the library home page.
0007 //
0008 //  File        : $RCSfile$
0009 //
0010 //  Version     : $Revision$
0011 //
0012 //  Description : parameter modifiers
0013 // ***************************************************************************
0014 
0015 #ifndef BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP
0016 #define BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP
0017 
0018 // Boost.Test Runtime parameters
0019 #include <boost/test/utils/runtime/fwd.hpp>
0020 
0021 // Boost.Test
0022 #include <boost/test/utils/named_params.hpp>
0023 #include <boost/test/detail/global_typedef.hpp>
0024 
0025 #include <boost/test/detail/suppress_warnings.hpp>
0026 
0027 
0028 // New CLA API available only for some C++11 compilers
0029 #if    !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \
0030     && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) \
0031     && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) \
0032     && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
0033 #define BOOST_TEST_CLA_NEW_API
0034 #endif
0035 
0036 namespace boost {
0037 namespace runtime {
0038 
0039 // ************************************************************************** //
0040 // **************         environment variable modifiers       ************** //
0041 // ************************************************************************** //
0042 
0043 namespace {
0044 
0045 #ifdef BOOST_TEST_CLA_NEW_API
0046 auto const& description     = unit_test::static_constant<nfp::typed_keyword<cstring,struct description_t>>::value;
0047 auto const& help            = unit_test::static_constant<nfp::typed_keyword<cstring,struct help_t>>::value;
0048 auto const& env_var         = unit_test::static_constant<nfp::typed_keyword<cstring,struct env_var_t>>::value;
0049 auto const& end_of_params   = unit_test::static_constant<nfp::typed_keyword<cstring,struct end_of_params_t>>::value;
0050 auto const& negation_prefix = unit_test::static_constant<nfp::typed_keyword<cstring,struct neg_prefix_t>>::value;
0051 auto const& value_hint      = unit_test::static_constant<nfp::typed_keyword<cstring,struct value_hint_t>>::value;
0052 auto const& optional_value  = unit_test::static_constant<nfp::keyword<struct optional_value_t>>::value;
0053 auto const& default_value   = unit_test::static_constant<nfp::keyword<struct default_value_t>>::value;
0054 auto const& callback        = unit_test::static_constant<nfp::keyword<struct callback_t>>::value;
0055 
0056 template<typename EnumType>
0057 using enum_values = unit_test::static_constant<
0058   nfp::typed_keyword<std::initializer_list<std::pair<const cstring,EnumType>>, struct enum_values_t>
0059 >;
0060 
0061 #else
0062 
0063 nfp::typed_keyword<cstring,struct description_t> description;
0064 nfp::typed_keyword<cstring,struct help_t> help;
0065 nfp::typed_keyword<cstring,struct env_var_t> env_var;
0066 nfp::typed_keyword<cstring,struct end_of_params_t> end_of_params;
0067 nfp::typed_keyword<cstring,struct neg_prefix_t> negation_prefix;
0068 nfp::typed_keyword<cstring,struct value_hint_t> value_hint;
0069 nfp::keyword<struct optional_value_t> optional_value;
0070 nfp::keyword<struct default_value_t> default_value;
0071 nfp::keyword<struct callback_t> callback;
0072 
0073 template<typename EnumType>
0074 struct enum_values_list {
0075     typedef std::pair<cstring,EnumType> ElemT;
0076     typedef std::vector<ElemT> ValuesT;
0077 
0078     enum_values_list const&
0079     operator()( cstring k, EnumType v ) const
0080     {
0081         const_cast<enum_values_list*>(this)->m_values.push_back( ElemT( k, v ) );
0082 
0083         return *this;
0084     }
0085 
0086     operator ValuesT const&() const { return m_values; }
0087 
0088 private:
0089     ValuesT m_values;
0090 };
0091 
0092 template<typename EnumType>
0093 struct enum_values : unit_test::static_constant<
0094   nfp::typed_keyword<enum_values_list<EnumType>, struct enum_values_t> >
0095 {
0096 };
0097 
0098 #endif
0099 
0100 } // local namespace
0101 
0102 } // namespace runtime
0103 } // namespace boost
0104 
0105 #include <boost/test/detail/enable_warnings.hpp>
0106 
0107 #endif // BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP