Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67774 - in trunk: boost/program_options libs/program_options/doc libs/program_options/src
From: ghost_at_[hidden]
Date: 2011-01-08 06:45:52


Author: vladimir_prus
Date: 2011-01-08 06:45:50 EST (Sat, 08 Jan 2011)
New Revision: 67774
URL: http://svn.boost.org/trac/boost/changeset/67774

Log:
Clarify docs for 'zero_token'.
Fixes #1132.

Text files modified:
   trunk/boost/program_options/value_semantic.hpp | 10 +++++++++-
   trunk/libs/program_options/doc/overview.xml | 2 +-
   trunk/libs/program_options/src/cmdline.cpp | 2 +-
   3 files changed, 11 insertions(+), 3 deletions(-)

Modified: trunk/boost/program_options/value_semantic.hpp
==============================================================================
--- trunk/boost/program_options/value_semantic.hpp (original)
+++ trunk/boost/program_options/value_semantic.hpp 2011-01-08 06:45:50 EST (Sat, 08 Jan 2011)
@@ -261,13 +261,21 @@
             return this;
         }
 
- /** Specifies that the value can span multiple tokens. */
+ /** Specifies that the value can span multiple tokens.
+ */
         typed_value* multitoken()
         {
             m_multitoken = true;
             return this;
         }
 
+ /** Specifies that no tokens may be provided as the value of
+ this option, which means that only presense of the option
+ is significant. For such option to be useful, either the
+ 'validate' function should be specialized, or the
+ 'implicit_value' method should be also used. In most
+ cases, you can use the 'bool_switch' function instead of
+ using this method. */
         typed_value* zero_tokens()
         {
             m_zero_tokens = true;

Modified: trunk/libs/program_options/doc/overview.xml
==============================================================================
--- trunk/libs/program_options/doc/overview.xml (original)
+++ trunk/libs/program_options/doc/overview.xml 2011-01-08 06:45:50 EST (Sat, 08 Jan 2011)
@@ -181,7 +181,7 @@
 desc.add_options()
     ("help", "produce help message")
     ("compression", value<string>(), "compression level")
- ("verbose", value<string>()->zero_tokens(), "verbosity level")
+ ("verbose", value<string>()->implicit_value("0"), "verbosity level")
     ("email", value<string>()->multitoken(), "email to send to")
     ;
       </programlisting>

Modified: trunk/libs/program_options/src/cmdline.cpp
==============================================================================
--- trunk/libs/program_options/src/cmdline.cpp (original)
+++ trunk/libs/program_options/src/cmdline.cpp 2011-01-08 06:45:50 EST (Sat, 08 Jan 2011)
@@ -277,7 +277,7 @@
         }
 
         /* If an key option is followed by a positional option,
- can can consume more tokens (e.g. it's multitoke option),
+ can can consume more tokens (e.g. it's multitoken option),
            give those tokens to it. */
         vector<option> result2;
         for (unsigned i = 0; i < result.size(); ++i)


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