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

Revision 857, 3.2 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: named_parameter.hpp,v $
9//
10//  Version     : $Revision: 1.1 $
11//
12//  Description : defines model of named parameter
13// ***************************************************************************
14
15#ifndef BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER
16#define BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER
17
18// Boost.Runtime.Parameter
19#include <boost/test/utils/runtime/config.hpp>
20
21#include <boost/test/utils/runtime/cla/basic_parameter.hpp>
22#include <boost/test/utils/runtime/cla/id_policy.hpp>
23
24namespace boost {
25
26namespace BOOST_RT_PARAM_NAMESPACE {
27
28namespace cla {
29
30// ************************************************************************** //
31// **************              string_name_policy              ************** //
32// ************************************************************************** //
33
34class string_name_policy : public basic_naming_policy {
35public:
36    // Constructor
37    string_name_policy();
38    BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~string_name_policy() {}
39
40    // policy interface
41    virtual bool    responds_to( cstring name ) const;
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        if( m.has( guess_name_m ) )
51            m_guess_name = true;
52    }
53
54private:
55    // Naming policy interface
56    virtual bool    match_name( argv_traverser& tr ) const;
57
58    // Data members
59    bool            m_guess_name;
60};
61
62// ************************************************************************** //
63// **************         runtime::cla::named_parameter        ************** //
64// ************************************************************************** //
65
66template<typename T>
67class named_parameter_t : public basic_parameter<T,string_name_policy> {
68    typedef basic_parameter<T,string_name_policy> base;
69public:
70    // Constructors
71    explicit    named_parameter_t( cstring name ) : base( name ) {}
72};
73
74//____________________________________________________________________________//
75
76BOOST_RT_CLA_NAMED_PARAM_GENERATORS( named_parameter )
77
78//____________________________________________________________________________//
79
80} // namespace cla
81
82} // namespace BOOST_RT_PARAM_NAMESPACE
83
84} // namespace boost
85
86#ifndef BOOST_RT_PARAM_OFFLINE
87
88#  define BOOST_RT_PARAM_INLINE inline
89#  include <boost/test/utils/runtime/cla/named_parameter.ipp>
90
91#endif
92
93// ************************************************************************** //
94//   Revision History:
95//
96//   $Log: named_parameter.hpp,v $
97//   Revision 1.1  2005/04/12 06:42:43  rogeeff
98//   Runtime.Param library initial commit
99//
100// ************************************************************************** //
101
102#endif // BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER
Note: See TracBrowser for help on using the repository browser.