Commit 32ca8c5c7cba4909067a445ee23ae6ede0744f33
Merge branch 'untangle_includes' of https://github.com/DennisOSRM/cxxopts into untangle-includes
Conflicts: src/cxxopts.hpp
Showing
2 changed files
with
24 additions
and
22 deletions
src/cxxopts.cpp
| ... | ... | @@ -24,6 +24,8 @@ THE SOFTWARE. |
| 24 | 24 | |
| 25 | 25 | #include "cxxopts.hpp" |
| 26 | 26 | |
| 27 | +#include <regex> | |
| 28 | + | |
| 27 | 29 | #define OPTION_LONGEST 30 |
| 28 | 30 | #define OPTION_DESC_GAP 2 |
| 29 | 31 | |
| ... | ... | @@ -136,8 +138,8 @@ Options::add_options(std::string group) |
| 136 | 138 | |
| 137 | 139 | OptionAdder& |
| 138 | 140 | OptionAdder::operator() |
| 139 | -( | |
| 140 | - const std::string& opts, | |
| 141 | +( | |
| 142 | + const std::string& opts, | |
| 141 | 143 | const std::string& desc, |
| 142 | 144 | std::shared_ptr<const Value> value |
| 143 | 145 | ) |
| ... | ... | @@ -162,7 +164,7 @@ void |
| 162 | 164 | Options::parse_option |
| 163 | 165 | ( |
| 164 | 166 | std::shared_ptr<OptionDetails> value, |
| 165 | - const std::string& name, | |
| 167 | + const std::string& name, | |
| 166 | 168 | const std::string& arg |
| 167 | 169 | ) |
| 168 | 170 | { |
| ... | ... | @@ -291,7 +293,7 @@ Options::parse(int& argc, char**& argv) |
| 291 | 293 | else if (result[1].length() != 0) |
| 292 | 294 | { |
| 293 | 295 | std::string name = result[1]; |
| 294 | - | |
| 296 | + | |
| 295 | 297 | auto iter = m_options.find(name); |
| 296 | 298 | |
| 297 | 299 | if (iter == m_options.end()) |
| ... | ... | @@ -343,8 +345,8 @@ void |
| 343 | 345 | Options::add_option |
| 344 | 346 | ( |
| 345 | 347 | const std::string& group, |
| 346 | - const std::string& s, | |
| 347 | - const std::string& l, | |
| 348 | + const std::string& s, | |
| 349 | + const std::string& l, | |
| 348 | 350 | const std::string& desc, |
| 349 | 351 | std::shared_ptr<const Value> value |
| 350 | 352 | ) |
| ... | ... | @@ -397,7 +399,7 @@ Options::help_one_group(const std::string& g) const |
| 397 | 399 | size_t longest = 0; |
| 398 | 400 | |
| 399 | 401 | std::string result; |
| 400 | - | |
| 402 | + | |
| 401 | 403 | if (!g.empty()) |
| 402 | 404 | { |
| 403 | 405 | result += " " + g + " options:\n\n"; |
| ... | ... | @@ -443,7 +445,7 @@ Options::help_one_group(const std::string& g) const |
| 443 | 445 | std::string |
| 444 | 446 | Options::help(const std::vector<std::string>& groups) const |
| 445 | 447 | { |
| 446 | - std::string result = "Usage:\n " + m_program + " [OPTION...] " | |
| 448 | + std::string result = "Usage:\n " + m_program + " [OPTION...] " | |
| 447 | 449 | + m_help_string + "\n\n"; |
| 448 | 450 | |
| 449 | 451 | for (const auto& g : groups) | ... | ... |
src/cxxopts.hpp
| ... | ... | @@ -25,13 +25,13 @@ THE SOFTWARE. |
| 25 | 25 | #ifndef CXX_OPTS_HPP |
| 26 | 26 | #define CXX_OPTS_HPP |
| 27 | 27 | |
| 28 | -#include <regex> | |
| 29 | -#include <set> | |
| 30 | -#include <map> | |
| 31 | 28 | #include <exception> |
| 32 | -#include <sstream> | |
| 33 | - | |
| 34 | 29 | #include <iostream> |
| 30 | +#include <map> | |
| 31 | +#include <memory> | |
| 32 | +#include <sstream> | |
| 33 | +#include <string> | |
| 34 | +#include <vector> | |
| 35 | 35 | |
| 36 | 36 | namespace cxxopts |
| 37 | 37 | { |
| ... | ... | @@ -133,7 +133,7 @@ namespace cxxopts |
| 133 | 133 | public: |
| 134 | 134 | option_not_has_argument_exception |
| 135 | 135 | ( |
| 136 | - const std::string& option, | |
| 136 | + const std::string& option, | |
| 137 | 137 | const std::string& arg |
| 138 | 138 | ) |
| 139 | 139 | : OptionParseException( |
| ... | ... | @@ -291,7 +291,7 @@ namespace cxxopts |
| 291 | 291 | { |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - const std::string& | |
| 294 | + const std::string& | |
| 295 | 295 | description() const |
| 296 | 296 | { |
| 297 | 297 | return m_desc; |
| ... | ... | @@ -364,8 +364,8 @@ namespace cxxopts |
| 364 | 364 | add_option |
| 365 | 365 | ( |
| 366 | 366 | const std::string& group, |
| 367 | - const std::string& s, | |
| 368 | - const std::string& l, | |
| 367 | + const std::string& s, | |
| 368 | + const std::string& l, | |
| 369 | 369 | const std::string& desc, |
| 370 | 370 | std::shared_ptr<const Value> value |
| 371 | 371 | ); |
| ... | ... | @@ -403,7 +403,7 @@ namespace cxxopts |
| 403 | 403 | help(const std::vector<std::string>& groups = {""}) const; |
| 404 | 404 | |
| 405 | 405 | private: |
| 406 | - | |
| 406 | + | |
| 407 | 407 | void |
| 408 | 408 | add_one_option |
| 409 | 409 | ( |
| ... | ... | @@ -421,10 +421,10 @@ namespace cxxopts |
| 421 | 421 | parse_option |
| 422 | 422 | ( |
| 423 | 423 | std::shared_ptr<OptionDetails> value, |
| 424 | - const std::string& name, | |
| 424 | + const std::string& name, | |
| 425 | 425 | const std::string& arg = "" |
| 426 | 426 | ); |
| 427 | - | |
| 427 | + | |
| 428 | 428 | void |
| 429 | 429 | checked_parse_arg |
| 430 | 430 | ( |
| ... | ... | @@ -459,8 +459,8 @@ namespace cxxopts |
| 459 | 459 | |
| 460 | 460 | OptionAdder& |
| 461 | 461 | operator() |
| 462 | - ( | |
| 463 | - const std::string& opts, | |
| 462 | + ( | |
| 463 | + const std::string& opts, | |
| 464 | 464 | const std::string& desc, |
| 465 | 465 | std::shared_ptr<const Value> value |
| 466 | 466 | = ::cxxopts::value<bool>() | ... | ... |