|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57819 - in trunk/libs/program_options: src test
From: s.ochsenknecht_at_[hidden]
Date: 2009-11-20 11:53:10
Author: s_ochsenknecht
Date: 2009-11-20 11:53:10 EST (Fri, 20 Nov 2009)
New Revision: 57819
URL: http://svn.boost.org/trac/boost/changeset/57819
Log:
allow empty values in config file, Fixes #1537
Text files modified:
trunk/libs/program_options/src/config_file.cpp | 8 ++++----
trunk/libs/program_options/test/parsers_test.cpp | 2 ++
2 files changed, 6 insertions(+), 4 deletions(-)
Modified: trunk/libs/program_options/src/config_file.cpp
==============================================================================
--- trunk/libs/program_options/src/config_file.cpp (original)
+++ trunk/libs/program_options/src/config_file.cpp 2009-11-20 11:53:10 EST (Fri, 20 Nov 2009)
@@ -105,10 +105,10 @@
bool registered = allowed_option(name);
if (!registered && !m_allow_unregistered)
boost::throw_exception(unknown_option(name));
-
- if (value.empty())
- boost::throw_exception(invalid_syntax(s, "no value given"));
-
+
+ if (value.empty())
+ continue;
+
found = true;
this->value().string_key = name;
this->value().value.clear();
Modified: trunk/libs/program_options/test/parsers_test.cpp
==============================================================================
--- trunk/libs/program_options/test/parsers_test.cpp (original)
+++ trunk/libs/program_options/test/parsers_test.cpp 2009-11-20 11:53:10 EST (Fri, 20 Nov 2009)
@@ -202,6 +202,7 @@
desc.add_options()
("gv1", new untyped_value)
("gv2", new untyped_value)
+ ("empty_value", new untyped_value)
("plug*", new untyped_value)
("m1.v1", new untyped_value)
("m1.v2", new untyped_value)
@@ -210,6 +211,7 @@
const char content1[] =
" gv1 = 0#asd\n"
+ "empty_value = \n"
"plug3 = 7\n"
"b = true\n"
"[m1]\n"
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