Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53441 - in trunk/libs/program_options: src test
From: ghost_at_[hidden]
Date: 2009-05-30 06:34:37


Author: vladimir_prus
Date: 2009-05-30 06:34:37 EDT (Sat, 30 May 2009)
New Revision: 53441
URL: http://svn.boost.org/trac/boost/changeset/53441

Log:
Properly convert original_tokens and unregistered to woption.

Fixes #2425.

Text files modified:
   trunk/libs/program_options/src/parsers.cpp | 6 ++++++
   trunk/libs/program_options/test/unicode_test.cpp | 10 +++++++---
   2 files changed, 13 insertions(+), 3 deletions(-)

Modified: trunk/libs/program_options/src/parsers.cpp
==============================================================================
--- trunk/libs/program_options/src/parsers.cpp (original)
+++ trunk/libs/program_options/src/parsers.cpp 2009-05-30 06:34:37 EDT (Sat, 30 May 2009)
@@ -67,10 +67,16 @@
             woption result;
             result.string_key = opt.string_key;
             result.position_key = opt.position_key;
+ result.unregistered = opt.unregistered;
             
             std::transform(opt.value.begin(), opt.value.end(),
                            back_inserter(result.value),
                            bind(from_utf8, _1));
+
+ std::transform(opt.original_tokens.begin(),
+ opt.original_tokens.end(),
+ back_inserter(result.original_tokens),
+ bind(from_utf8, _1));
             return result;
         }
     }

Modified: trunk/libs/program_options/test/unicode_test.cpp
==============================================================================
--- trunk/libs/program_options/test/unicode_test.cpp (original)
+++ trunk/libs/program_options/test/unicode_test.cpp 2009-05-30 06:34:37 EDT (Sat, 30 May 2009)
@@ -34,9 +34,13 @@
     args.push_back(L"--foo=\x044F");
 
     variables_map vm;
- store(wcommand_line_parser(args).options(desc).run(), vm);
-
- BOOST_CHECK(vm["foo"].as<wstring>() == L"\x044F");
+ basic_parsed_options<wchar_t> parsed =
+ wcommand_line_parser(args).options(desc).run();
+ store(parsed, vm);
+
+ BOOST_CHECK(vm["foo"].as<wstring>() == L"\x044F");
+ BOOST_CHECK(parsed.options[0].original_tokens.size() == 1);
+ BOOST_CHECK(parsed.options[0].original_tokens[0] == L"--foo=\x044F");
 }
 
 // Test that unicode input is property converted into


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