]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // (C) Copyright Gennadiy Rozental 2001. |
2 | // Use, modification, and distribution are subject to the | |
3 | // Boost Software License, Version 1.0. (See accompanying file | |
4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | // See http://www.boost.org/libs/test for the library home page. | |
7 | // | |
8 | // File : $RCSfile$ | |
9 | // | |
10 | // Version : $Revision$ | |
11 | // | |
12 | // Description : parameter modifiers | |
13 | // *************************************************************************** | |
14 | ||
15 | #ifndef BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP | |
16 | #define BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP | |
17 | ||
18 | // Boost.Test Runtime parameters | |
19 | #include <boost/test/utils/runtime/fwd.hpp> | |
20 | ||
21 | // Boost.Test | |
22 | #include <boost/test/utils/named_params.hpp> | |
23 | ||
24 | #include <boost/test/detail/suppress_warnings.hpp> | |
25 | ||
26 | ||
27 | // New CLA API available only for some C++11 compilers | |
28 | #if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ | |
29 | && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) \ | |
30 | && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) \ | |
31 | && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) | |
32 | #define BOOST_TEST_CLA_NEW_API | |
33 | #endif | |
34 | ||
35 | namespace boost { | |
36 | namespace runtime { | |
37 | ||
38 | // ************************************************************************** // | |
39 | // ************** environment variable modifiers ************** // | |
40 | // ************************************************************************** // | |
41 | ||
42 | namespace { | |
43 | ||
44 | #ifdef BOOST_TEST_CLA_NEW_API | |
45 | auto const& description = unit_test::static_constant<nfp::typed_keyword<cstring,struct description_t>>::value; | |
46 | auto const& help = unit_test::static_constant<nfp::typed_keyword<cstring,struct help_t>>::value; | |
47 | auto const& env_var = unit_test::static_constant<nfp::typed_keyword<cstring,struct env_var_t>>::value; | |
48 | auto const& end_of_params = unit_test::static_constant<nfp::typed_keyword<cstring,struct end_of_params_t>>::value; | |
49 | auto const& negation_prefix = unit_test::static_constant<nfp::typed_keyword<cstring,struct neg_prefix_t>>::value; | |
50 | auto const& value_hint = unit_test::static_constant<nfp::typed_keyword<cstring,struct value_hint_t>>::value; | |
51 | auto const& optional_value = unit_test::static_constant<nfp::keyword<struct optional_value_t>>::value; | |
52 | auto const& default_value = unit_test::static_constant<nfp::keyword<struct default_value_t>>::value; | |
53 | auto const& callback = unit_test::static_constant<nfp::keyword<struct callback_t>>::value; | |
54 | ||
55 | template<typename EnumType> | |
56 | using enum_values = unit_test::static_constant< | |
57 | nfp::typed_keyword<std::initializer_list<std::pair<const cstring,EnumType>>, struct enum_values_t> | |
58 | >; | |
59 | ||
60 | #else | |
61 | ||
62 | nfp::typed_keyword<cstring,struct description_t> description; | |
63 | nfp::typed_keyword<cstring,struct help_t> help; | |
64 | nfp::typed_keyword<cstring,struct env_var_t> env_var; | |
65 | nfp::typed_keyword<cstring,struct end_of_params_t> end_of_params; | |
66 | nfp::typed_keyword<cstring,struct neg_prefix_t> negation_prefix; | |
67 | nfp::typed_keyword<cstring,struct value_hint_t> value_hint; | |
68 | nfp::keyword<struct optional_value_t> optional_value; | |
69 | nfp::keyword<struct default_value_t> default_value; | |
70 | nfp::keyword<struct callback_t> callback; | |
71 | ||
72 | template<typename EnumType> | |
73 | struct enum_values_list { | |
74 | typedef std::pair<cstring,EnumType> ElemT; | |
75 | typedef std::vector<ElemT> ValuesT; | |
76 | ||
77 | enum_values_list const& | |
78 | operator()( cstring k, EnumType v ) const | |
79 | { | |
80 | const_cast<enum_values_list*>(this)->m_values.push_back( ElemT( k, v ) ); | |
81 | ||
82 | return *this; | |
83 | } | |
84 | ||
85 | operator ValuesT const&() const { return m_values; } | |
86 | ||
87 | private: | |
88 | ValuesT m_values; | |
89 | }; | |
90 | ||
91 | template<typename EnumType> | |
92 | struct enum_values : unit_test::static_constant< | |
93 | nfp::typed_keyword<enum_values_list<EnumType>, struct enum_values_t> > | |
94 | { | |
95 | }; | |
96 | ||
97 | #endif | |
98 | ||
99 | } // local namespace | |
100 | ||
101 | } // namespace runtime | |
102 | } // namespace boost | |
103 | ||
104 | #include <boost/test/detail/enable_warnings.hpp> | |
105 | ||
106 | #endif // BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP |