Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/test/utils/runtime/cla/validation.ipp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.2 KB
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: validation.ipp,v $
9//
10//  Version     : $Revision: 1.1 $
11//
12//  Description : input validation helpers implementation
13// ***************************************************************************
14
15#ifndef BOOST_RT_CLA_VALIDATION_IPP_070604GER
16#define BOOST_RT_CLA_VALIDATION_IPP_070604GER
17
18// Boost.Runtime.Parameter
19#include <boost/test/utils/runtime/config.hpp>
20
21#include <boost/test/utils/runtime/cla/argv_traverser.hpp>
22#include <boost/test/utils/runtime/cla/validation.hpp>
23
24// Boost
25#include <boost/test/utils/basic_cstring/io.hpp>
26
27// STL
28
29namespace boost {
30
31namespace BOOST_RT_PARAM_NAMESPACE {
32
33namespace cla {
34
35// ************************************************************************** //
36// **************           runtime::cla::validation           ************** //
37// ************************************************************************** //
38
39BOOST_RT_PARAM_INLINE void
40report_input_error( argv_traverser const& tr, format_stream& msg )
41{
42    if( tr.eoi() )
43        msg << BOOST_RT_PARAM_LITERAL( " at the end of input" );
44    else {
45        msg << BOOST_RT_PARAM_LITERAL( " in the following position: " );
46
47        if( tr.input().size() > 5 )
48            msg << tr.input().substr( 0, 5 ) << BOOST_RT_PARAM_LITERAL( "..." );
49        else
50            msg << tr.input();
51    }
52
53    throw BOOST_RT_PARAM_NAMESPACE::logic_error( msg.str() );
54}
55
56//____________________________________________________________________________//
57
58} // namespace cla
59
60} // namespace BOOST_RT_PARAM_NAMESPACE
61
62} // namespace boost
63
64// ************************************************************************** //
65//   Revision History:
66//
67//   $Log: validation.ipp,v $
68//   Revision 1.1  2005/04/12 06:42:43  rogeeff
69//   Runtime.Param library initial commit
70//
71// ************************************************************************** //
72
73#endif // BOOST_RT_CLA_VALIDATION_IPP_070604GER
Note: See TracBrowser for help on using the repository browser.