[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 |
|
---|
| 24 | namespace boost {
|
---|
| 25 |
|
---|
| 26 | namespace BOOST_RT_PARAM_NAMESPACE {
|
---|
| 27 |
|
---|
| 28 | namespace cla {
|
---|
| 29 |
|
---|
| 30 | namespace rt_cla_detail {
|
---|
| 31 |
|
---|
| 32 | // ************************************************************************** //
|
---|
| 33 | // ************** runtime::cla::const_generator ************** //
|
---|
| 34 | // ************************************************************************** //
|
---|
| 35 |
|
---|
| 36 | template<typename T>
|
---|
| 37 | class const_generator {
|
---|
| 38 | public:
|
---|
| 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 |
|
---|
| 45 | private:
|
---|
| 46 | // Data members
|
---|
| 47 | T m_const_value;
|
---|
| 48 | };
|
---|
| 49 |
|
---|
| 50 | // ************************************************************************** //
|
---|
| 51 | // ************** runtime::cla::ref_generator ************** //
|
---|
| 52 | // ************************************************************************** //
|
---|
| 53 |
|
---|
| 54 | template<typename T>
|
---|
| 55 | class ref_generator {
|
---|
| 56 | public:
|
---|
| 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 |
|
---|
| 66 | private:
|
---|
| 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
|
---|