source: NonGTP/Boost/boost/test/utils/runtime/cla/id_policy.ipp @ 857

Revision 857, 3.3 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: id_policy.ipp,v $
9//
10//  Version     : $Revision: 1.1 $
11//
12//  Description : some generic identification policies implementation
13// ***************************************************************************
14
15#ifndef BOOST_RT_CLA_ID_POLICY_IPP_062904GER
16#define BOOST_RT_CLA_ID_POLICY_IPP_062904GER
17
18// Boost.Runtime.Parameter
19#include <boost/test/utils/runtime/config.hpp>
20
21#include <boost/test/utils/runtime/cla/id_policy.hpp>
22
23namespace boost {
24
25namespace BOOST_RT_PARAM_NAMESPACE {
26
27namespace cla {
28
29// ************************************************************************** //
30// **************              basic_naming_policy             ************** //
31// ************************************************************************** //
32
33BOOST_RT_PARAM_INLINE void
34basic_naming_policy::usage_info( format_stream& fs ) const
35{
36    fs << m_prefix << m_name << m_separator;
37
38    if( m_separator.empty() )
39        fs << BOOST_RT_PARAM_LITERAL( ' ' );
40}
41
42//____________________________________________________________________________//
43
44BOOST_RT_PARAM_INLINE bool
45basic_naming_policy::match_prefix( argv_traverser& tr ) const
46{
47    if( !tr.match_front( m_prefix ) )
48        return false;
49
50    tr.trim( m_prefix.size() );
51    return true;
52}
53
54//____________________________________________________________________________//
55   
56BOOST_RT_PARAM_INLINE bool
57basic_naming_policy::match_name( argv_traverser& tr ) const
58{
59    if( !tr.match_front( m_name ) )
60        return false;
61
62    tr.trim( m_name.size() );
63    return true;
64}
65
66//____________________________________________________________________________//
67   
68BOOST_RT_PARAM_INLINE bool
69basic_naming_policy::match_separator( argv_traverser& tr ) const
70{
71    if( m_separator.empty() ) {
72        if( !tr.token().is_empty() )
73            return false;
74
75        tr.trim( 1 );
76    }
77    else {
78        if( !tr.match_front( m_separator ) )
79            return false;
80
81        tr.trim( m_separator.size() );
82    }
83
84    return true;
85}
86
87//____________________________________________________________________________//
88
89BOOST_RT_PARAM_INLINE bool
90basic_naming_policy::matching( parameter const&, argv_traverser& tr, bool ) const
91{
92    if( !match_prefix( tr ) )
93        return false;
94       
95    if( !match_name( tr ) )
96        return false;
97
98    if( !match_separator( tr ) )
99        return false;
100
101    return true;
102}
103
104//____________________________________________________________________________//
105
106} // namespace cla
107
108} // namespace BOOST_RT_PARAM_NAMESPACE
109
110} // namespace boost
111
112// ************************************************************************** //
113//   Revision History:
114//
115//   $Log: id_policy.ipp,v $
116//   Revision 1.1  2005/04/12 06:42:43  rogeeff
117//   Runtime.Param library initial commit
118//
119// ************************************************************************** //
120
121#endif // BOOST_RT_CLA_ID_POLICY_IPP_062904GER
Note: See TracBrowser for help on using the repository browser.