Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74400 - in trunk/boost/test/utils/runtime: . cla
From: gennadiy.rozental_at_[hidden]
Date: 2011-09-15 23:19:44


Author: rogeeff
Date: 2011-09-15 23:19:43 EDT (Thu, 15 Sep 2011)
New Revision: 74400
URL: http://svn.boost.org/trac/boost/changeset/74400

Log:
facilitated CLA parser reuse for multiple parsing sessions
fixed bug in handling boolean parameters
Text files modified:
   trunk/boost/test/utils/runtime/cla/argv_traverser.ipp | 2 ++
   trunk/boost/test/utils/runtime/cla/parameter.hpp | 1 +
   trunk/boost/test/utils/runtime/cla/parser.hpp | 2 ++
   trunk/boost/test/utils/runtime/cla/parser.ipp | 9 +++++++++
   trunk/boost/test/utils/runtime/interpret_argument_value.hpp | 2 +-
   5 files changed, 15 insertions(+), 1 deletions(-)

Modified: trunk/boost/test/utils/runtime/cla/argv_traverser.ipp
==============================================================================
--- trunk/boost/test/utils/runtime/cla/argv_traverser.ipp (original)
+++ trunk/boost/test/utils/runtime/cla/argv_traverser.ipp 2011-09-15 23:19:43 EDT (Thu, 15 Sep 2011)
@@ -49,6 +49,8 @@
 BOOST_RT_PARAM_INLINE void
 argv_traverser::init( int argc, char_type** argv )
 {
+ m_buffer.clear();
+
     for( int index = 1; index < argc; ++index ) {
         m_buffer += argv[index];
         if( index != argc-1 )

Modified: trunk/boost/test/utils/runtime/cla/parameter.hpp
==============================================================================
--- trunk/boost/test/utils/runtime/cla/parameter.hpp (original)
+++ trunk/boost/test/utils/runtime/cla/parameter.hpp 2011-09-15 23:19:43 EDT (Thu, 15 Sep 2011)
@@ -81,6 +81,7 @@
     bool has_argument() const { return m_actual_argument; }
     argument const& actual_argument() const { return *m_actual_argument; }
     argument_ptr actual_argument() { return m_actual_argument; }
+ void reset() { m_actual_argument.reset(); }
 
 
     // identification interface

Modified: trunk/boost/test/utils/runtime/cla/parser.hpp
==============================================================================
--- trunk/boost/test/utils/runtime/cla/parser.hpp (original)
+++ trunk/boost/test/utils/runtime/cla/parser.hpp 2011-09-15 23:19:43 EDT (Thu, 15 Sep 2011)
@@ -100,6 +100,8 @@
     // parameters access
     param_iterator first_param() const;
     param_iterator last_param() const;
+ unsigned num_params() const { return m_parameters.size(); }
+ void reset();
 
     // arguments access
     const_argument_ptr operator[]( cstring string_id ) const;

Modified: trunk/boost/test/utils/runtime/cla/parser.ipp
==============================================================================
--- trunk/boost/test/utils/runtime/cla/parser.ipp (original)
+++ trunk/boost/test/utils/runtime/cla/parser.ipp 2011-09-15 23:19:43 EDT (Thu, 15 Sep 2011)
@@ -249,6 +249,15 @@
 
 //____________________________________________________________________________//
 
+BOOST_RT_PARAM_INLINE void
+parser::reset()
+{
+ BOOST_TEST_FOREACH( parameter_ptr const&, param, m_parameters )
+ param->reset();
+}
+
+//____________________________________________________________________________//
+
 } // namespace cla
 
 } // namespace BOOST_RT_PARAM_NAMESPACE

Modified: trunk/boost/test/utils/runtime/interpret_argument_value.hpp
==============================================================================
--- trunk/boost/test/utils/runtime/interpret_argument_value.hpp (original)
+++ trunk/boost/test/utils/runtime/interpret_argument_value.hpp 2011-09-15 23:19:43 EDT (Thu, 15 Sep 2011)
@@ -114,7 +114,7 @@
         }
         else {
             res = true;
- return false;
+ return source.is_empty();
         }
     }
 };


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk