1 //  (C) Copyright Gennadiy Rozental 2005-2008.
2 //  Permission to copy, use, modify, sell and distribute this software
3 //  is granted provided this copyright notice appears in all copies.
4 //  This software is provided "as is" without express or implied warranty,
5 //  and with no claim as to its suitability for any purpose.
6 
7 //  See http://www.boost.org for updates, documentation, and revision history.
8 //
9 //  File        : $RCSfile$
10 //
11 //  Version     : $Revision: 54633 $
12 //
13 //  Description : argument usage printing helpers
14 // ***************************************************************************
15 
16 #ifndef BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER
17 #define BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER
18 
19 // Boost.Runtime.Parameter
20 #include <boost/test/utils/runtime/config.hpp>
21 #include <boost/test/utils/runtime/cla/argv_traverser.hpp>
22 
23 // Boost.Test
24 #include <boost/test/utils/basic_cstring/io.hpp>
25 #include <boost/test/utils/basic_cstring/compare.hpp>
26 
27 #include <boost/lexical_cast.hpp>
28 
29 // STL
30 // !! can we eliminate these includes?
31 #include <list>
32 
33 namespace boost {
34 
35 namespace BOOST_RT_PARAM_NAMESPACE {
36 
37 namespace cla {
38 
39 namespace rt_cla_detail {
40 
41 // ************************************************************************** //
42 // **************             argument_value_usage             ************** //
43 // ************************************************************************** //
44 
45 // generic case
46 template<typename T>
47 inline void
argument_value_usage(format_stream & fs,long,T * =0)48 argument_value_usage( format_stream& fs, long, T* = 0 )
49 {
50     fs << BOOST_RT_PARAM_CSTRING_LITERAL( "<value>" );
51 }
52 
53 //____________________________________________________________________________//
54 
55 // specialization for list of values
56 template<typename T>
57 inline void
argument_value_usage(format_stream & fs,int,std::list<T> * =0)58 argument_value_usage( format_stream& fs, int, std::list<T>* = 0 )
59 {
60     fs << BOOST_RT_PARAM_CSTRING_LITERAL( "(<value1>, ..., <valueN>)" );
61 }
62 
63 //____________________________________________________________________________//
64 
65 // specialization for type bool
66 inline void
argument_value_usage(format_stream & fs,int,bool * =0)67 argument_value_usage( format_stream& fs,  int, bool* = 0 )
68 {
69     fs << BOOST_RT_PARAM_CSTRING_LITERAL( "yes|y|no|n" );
70 }
71 
72 //____________________________________________________________________________//
73 
74 } // namespace rt_cla_detail
75 
76 } // namespace cla
77 
78 } // namespace BOOST_RT_PARAM_NAMESPACE
79 
80 } // namespace boost
81 
82 #endif // BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER
83