From 7051655c766120cf523e6593c501cf8eb984adab Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 8 Jan 2011 11:45:50 +0000 Subject: [PATCH] Clarify docs for 'zero_token'. Fixes #1132. [SVN r67774] --- doc/overview.xml | 2 +- include/boost/program_options/value_semantic.hpp | 10 +++++++++- src/cmdline.cpp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/overview.xml b/doc/overview.xml index 09af655..dcfbaf4 100644 --- a/doc/overview.xml +++ b/doc/overview.xml @@ -181,7 +181,7 @@ options_description desc; 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") ; diff --git a/include/boost/program_options/value_semantic.hpp b/include/boost/program_options/value_semantic.hpp index 033009e..7b34bb2 100644 --- a/include/boost/program_options/value_semantic.hpp +++ b/include/boost/program_options/value_semantic.hpp @@ -261,13 +261,21 @@ namespace boost { namespace program_options { 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; diff --git a/src/cmdline.cpp b/src/cmdline.cpp index be31385..09e0256 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -277,7 +277,7 @@ namespace boost { namespace program_options { namespace detail { } /* 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