source: NonGTP/Boost/boost/test/utils/runtime/cla/dual_name_parameter.hpp @ 857

Revision 857, 3.1 KB checked in by igarcia, 18 years ago (diff)
Line 
1//  (C) Copyright Gennadiy Rozental 2005.
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: dual_name_parameter.hpp,v $
9//
10//  Version     : $Revision: 1.1 $
11//
12//  Description : defines model of generic parameter with dual naming
13// ***************************************************************************
14
15#ifndef BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER
16#define BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER
17
18// Boost.Runtime.Parameter
19#include <boost/test/utils/runtime/config.hpp>
20
21#include <boost/test/utils/runtime/cla/named_parameter.hpp>
22#include <boost/test/utils/runtime/cla/char_parameter.hpp>
23
24namespace boost {
25
26namespace BOOST_RT_PARAM_NAMESPACE {
27
28namespace cla {
29
30// ************************************************************************** //
31// **************               dual_name_policy               ************** //
32// ************************************************************************** //
33
34class dual_name_policy : public dual_id_policy<dual_name_policy,string_name_policy,char_name_policy> {
35public:
36    dual_name_policy();
37
38    // Accept modifer
39    template<typename Modifier>
40    void    accept_modifier( Modifier const& m )
41    {
42        if( m.has( prefix ) )
43            set_prefix( m[prefix] );
44
45        if( m.has( name ) )
46            set_name( m[name] );
47
48        if( m.has( separator ) )
49            set_separator( m[separator] );
50    }
51private:
52    void    set_prefix( cstring );
53    void    set_name( cstring );
54    void    set_separator( cstring );
55};
56
57// ************************************************************************** //
58// **************       runtime::cla::dual_name_parameter      ************** //
59// ************************************************************************** //
60
61template<typename T>
62class dual_name_parameter_t : public basic_parameter<T,dual_name_policy> {
63    typedef basic_parameter<T,dual_name_policy> base;
64public:
65    // Constructors
66    explicit    dual_name_parameter_t( cstring name ) : base( name ) {}
67};
68
69//____________________________________________________________________________//
70
71BOOST_RT_CLA_NAMED_PARAM_GENERATORS( dual_name_parameter )
72
73//____________________________________________________________________________//
74
75} // namespace cla
76
77} // namespace BOOST_RT_PARAM_NAMESPACE
78
79} // namespace boost
80
81#ifndef BOOST_RT_PARAM_OFFLINE
82
83#  define BOOST_RT_PARAM_INLINE inline
84#  include <boost/test/utils/runtime/cla/dual_name_parameter.ipp>
85
86#endif
87
88// ************************************************************************** //
89//   Revision History:
90//
91//   $Log: dual_name_parameter.hpp,v $
92//   Revision 1.1  2005/04/12 06:42:43  rogeeff
93//   Runtime.Param library initial commit
94//
95// ************************************************************************** //
96
97#endif // BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER
Note: See TracBrowser for help on using the repository browser.