diff -r 510d5bd079ad boost/program_options/detail/value_semantic.hpp
|
a
|
b
|
|
| 55 | 55 | { |
| 56 | 56 | static std::basic_string<charT> empty; |
| 57 | 57 | if (v.size() > 1) |
| 58 | | throw validation_error("multiple values not allowed"); |
| | 58 | boost::throw_exception(validation_error("multiple values not allowed")); |
| 59 | 59 | if (v.size() == 1) |
| 60 | 60 | return v.front(); |
| 61 | 61 | else if (allow_empty) |
| 62 | 62 | return empty; |
| 63 | 63 | else |
| 64 | | throw validation_error("at least one value required"); |
| | 64 | boost::throw_exception(validation_error("at least one value required")); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /* Throws multiple_occurrences if 'value' is not empty. */ |
diff -r 510d5bd079ad libs/program_options/src/cmdline.cpp
|
a
|
b
|
|
| 151 | 151 | error = "style disallows all characters for short options"; |
| 152 | 152 | |
| 153 | 153 | if (error) |
| 154 | | throw invalid_command_line_style(error); |
| | 154 | boost::throw_exception(invalid_command_line_style(error)); |
| 155 | 155 | |
| 156 | 156 | // Need to check that if guessing and long disguise are enabled |
| 157 | 157 | // -f will mean the same as -foo |
| … |
… |
|
| 269 | 269 | if (opt.position_key != -1) { |
| 270 | 270 | if (position >= m_positional->max_total_count()) |
| 271 | 271 | { |
| 272 | | throw too_many_positional_options_error( |
| 273 | | "too many positional options"); |
| | 272 | boost::throw_exception(too_many_positional_options_error( |
| | 273 | "too many positional options")); |
| 274 | 274 | } |
| 275 | 275 | opt.string_key = m_positional->name_for_position(position); |
| 276 | 276 | ++position; |
| … |
… |
|
| 323 | 323 | if (present_tokens >= min_tokens) |
| 324 | 324 | { |
| 325 | 325 | if (!opt.value.empty() && max_tokens == 0) { |
| 326 | | throw invalid_command_line_syntax(opt.string_key, |
| 327 | | invalid_command_line_syntax::extra_parameter); |
| | 326 | boost::throw_exception(invalid_command_line_syntax(opt.string_key, |
| | 327 | invalid_command_line_syntax::extra_parameter)); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | max_tokens -= opt.value.size(); |
| … |
… |
|
| 346 | 346 | } |
| 347 | 347 | else |
| 348 | 348 | { |
| 349 | | throw invalid_command_line_syntax(opt.string_key, |
| 350 | | invalid_command_line_syntax::missing_parameter); |
| | 349 | boost::throw_exception(invalid_command_line_syntax(opt.string_key, |
| | 350 | invalid_command_line_syntax::missing_parameter)); |
| 351 | 351 | |
| 352 | 352 | } |
| 353 | 353 | } |
| … |
… |
|
| 367 | 367 | name = tok.substr(2, p-2); |
| 368 | 368 | adjacent = tok.substr(p+1); |
| 369 | 369 | if (adjacent.empty()) |
| 370 | | throw invalid_command_line_syntax(name, |
| 371 | | invalid_command_line_syntax::empty_adjacent_parameter); |
| | 370 | boost::throw_exception( invalid_command_line_syntax(name, |
| | 371 | invalid_command_line_syntax::empty_adjacent_parameter)); |
| 372 | 372 | } |
| 373 | 373 | else |
| 374 | 374 | { |
diff -r 510d5bd079ad libs/program_options/src/variables_map.cpp
|
a
|
b
|
|
| 74 | 74 | try { |
| 75 | 75 | d.semantic()->parse(v.value(), options.options[i].value, utf8); |
| 76 | 76 | } |
| | 77 | #ifndef BOOST_NO_EXCEPTIONS |
| 77 | 78 | catch(validation_error& e) |
| 78 | 79 | { |
| 79 | 80 | e.set_option_name(name); |
| 80 | 81 | throw; |
| 81 | 82 | } |
| | 83 | #endif |
| 82 | 84 | v.m_value_semantic = d.semantic(); |
| 83 | 85 | |
| 84 | 86 | // The option is not composing, and the value is explicitly |