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

Revision 857, 2.7 KB checked in by igarcia, 18 years ago (diff)
RevLine 
[857]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: value_generator.hpp,v $
9//
10//  Version     : $Revision: 1.1 $
11//
12//  Description : specific value generators
13// ***************************************************************************
14
15#ifndef BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER
16#define BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER
17
18// Boost.Runtime.Parameter
19#include <boost/test/utils/runtime/config.hpp>
20
21#include <boost/test/utils/runtime/cla/fwd.hpp>
22#include <boost/test/utils/runtime/cla/parser.hpp>
23
24namespace boost {
25
26namespace BOOST_RT_PARAM_NAMESPACE {
27
28namespace cla {
29
30namespace rt_cla_detail {
31
32// ************************************************************************** //
33// **************        runtime::cla::const_generator         ************** //
34// ************************************************************************** //
35
36template<typename T>
37class const_generator {
38public:
39    // Constructor
40    explicit    const_generator( T const& t ) : m_const_value( t ) {}
41
42    // generator interface
43    void        operator()( parser const&, boost::optional<T>& t ) const   { t = m_const_value; }
44
45private:
46    // Data members
47    T           m_const_value;
48};
49
50// ************************************************************************** //
51// **************         runtime::cla::ref_generator          ************** //
52// ************************************************************************** //
53
54template<typename T>
55class ref_generator {
56public:
57    // Constructor
58    explicit    ref_generator( cstring ref_id ) : m_ref_id( ref_id ) {}
59
60    // generator interface
61    void        operator()( parser const& p, boost::optional<T>& t ) const
62    {
63        p.get( m_ref_id, t );
64    }
65
66private:
67    // Data members
68    cstring     m_ref_id;
69};
70
71//____________________________________________________________________________//
72
73} // namespace rt_cla_detail
74
75} // namespace cla
76
77} // namespace BOOST_RT_PARAM_NAMESPACE
78
79} // namespace boost
80
81// ************************************************************************** //
82//   Revision History:
83//
84//   $Log: value_generator.hpp,v $
85//   Revision 1.1  2005/04/12 06:42:43  rogeeff
86//   Runtime.Param library initial commit
87//
88// ************************************************************************** //
89
90#endif // BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER
Note: See TracBrowser for help on using the repository browser.