Commit 32ca8c5c7cba4909067a445ee23ae6ede0744f33

Authored by Jarryd Beck
2 parents b981b120 0fe22a51

Merge branch 'untangle_includes' of https://github.com/DennisOSRM/cxxopts into untangle-includes

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