Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/test/utils/runtime/cla/char_parameter.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 // (C) Copyright Gennadiy Rozental 2005-2008. | |
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: 54633 $ | |
11 // | |
12 // Description : defines model of parameter with single char name | |
13 // *************************************************************************** | |
14 | |
15 #ifndef BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER | |
16 #define BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER | |
17 | |
18 // Boost.Runtime.Parameter | |
19 #include <boost/test/utils/runtime/config.hpp> | |
20 #include <boost/test/utils/runtime/validation.hpp> | |
21 | |
22 #include <boost/test/utils/runtime/cla/basic_parameter.hpp> | |
23 #include <boost/test/utils/runtime/cla/id_policy.hpp> | |
24 | |
25 namespace boost { | |
26 | |
27 namespace BOOST_RT_PARAM_NAMESPACE { | |
28 | |
29 namespace cla { | |
30 | |
31 // ************************************************************************** // | |
32 // ************** char_name_policy ************** // | |
33 // ************************************************************************** // | |
34 | |
35 class char_name_policy : public basic_naming_policy { | |
36 public: | |
37 // Constructor | |
38 char_name_policy(); | |
39 BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~char_name_policy() {} | |
40 | |
41 // policy interface | |
42 virtual bool conflict_with( identification_policy const& ) const; | |
43 | |
44 // Accept modifier | |
45 template<typename Modifier> | |
46 void accept_modifier( Modifier const& m ) | |
47 { | |
48 basic_naming_policy::accept_modifier( m ); | |
49 | |
50 BOOST_RT_PARAM_VALIDATE_LOGIC( p_name->size() <= 1, "Invalid parameter name " << p_name ); | |
51 } | |
52 }; | |
53 | |
54 // ************************************************************************** // | |
55 // ************** runtime::cla::char_parameter ************** // | |
56 // ************************************************************************** // | |
57 | |
58 template<typename T> | |
59 class char_parameter_t : public basic_parameter<T,char_name_policy> { | |
60 typedef basic_parameter<T,char_name_policy> base; | |
61 public: | |
62 // Constructors | |
63 explicit char_parameter_t( char_type name ) : base( cstring( &name, 1 ) ) {} | |
64 }; | |
65 | |
66 //____________________________________________________________________________// | |
67 | |
68 template<typename T> | |
69 inline shared_ptr<char_parameter_t<T> > | |
70 char_parameter( char_type name ) | |
71 { | |
72 return shared_ptr<char_parameter_t<T> >( new char_parameter_t<T>( name ) ); | |
73 } | |
74 | |
75 //____________________________________________________________________________// | |
76 | |
77 inline shared_ptr<char_parameter_t<cstring> > | |
78 char_parameter( char_type name ) | |
79 { | |
80 return shared_ptr<char_parameter_t<cstring> >( new char_parameter_t<cstring>( name ) ); | |
81 } | |
82 | |
83 //____________________________________________________________________________// | |
84 | |
85 } // namespace cla | |
86 | |
87 } // namespace BOOST_RT_PARAM_NAMESPACE | |
88 | |
89 } // namespace boost | |
90 | |
91 #ifndef BOOST_RT_PARAM_OFFLINE | |
92 | |
93 # define BOOST_RT_PARAM_INLINE inline | |
94 # include <boost/test/utils/runtime/cla/char_parameter.ipp> | |
95 | |
96 #endif | |
97 | |
98 #endif // BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER |