Commit 0fe22a5171187339d2dfeb930784943c511610cc

Authored by Dennis Luxen
1 parent 1d9ae57a

untangle includes

- order lexicographically
- include all used headers directly instead of implicit includes
- remove unused header
- move regex include into compile unit
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
@@ -22,13 +22,13 @@ THE SOFTWARE. @@ -22,13 +22,13 @@ THE SOFTWARE.
22 22
23 */ 23 */
24 24
25 -#include <regex>  
26 -#include <set>  
27 -#include <map>  
28 #include <exception> 25 #include <exception>
29 -#include <sstream>  
30 -  
31 #include <iostream> 26 #include <iostream>
  27 +#include <map>
  28 +#include <memory>
  29 +#include <sstream>
  30 +#include <string>
  31 +#include <vector>
32 32
33 namespace cxxopts 33 namespace cxxopts
34 { 34 {
@@ -130,7 +130,7 @@ namespace cxxopts @@ -130,7 +130,7 @@ namespace cxxopts
130 public: 130 public:
131 option_not_has_argument_exception 131 option_not_has_argument_exception
132 ( 132 (
133 - const std::string& option, 133 + const std::string& option,
134 const std::string& arg 134 const std::string& arg
135 ) 135 )
136 : OptionParseException( 136 : OptionParseException(
@@ -288,7 +288,7 @@ namespace cxxopts @@ -288,7 +288,7 @@ namespace cxxopts
288 { 288 {
289 } 289 }
290 290
291 - const std::string& 291 + const std::string&
292 description() const 292 description() const
293 { 293 {
294 return m_desc; 294 return m_desc;
@@ -361,8 +361,8 @@ namespace cxxopts @@ -361,8 +361,8 @@ namespace cxxopts
361 add_option 361 add_option
362 ( 362 (
363 const std::string& group, 363 const std::string& group,
364 - const std::string& s,  
365 - const std::string& l, 364 + const std::string& s,
  365 + const std::string& l,
366 const std::string& desc, 366 const std::string& desc,
367 std::shared_ptr<const Value> value 367 std::shared_ptr<const Value> value
368 ); 368 );
@@ -400,7 +400,7 @@ namespace cxxopts @@ -400,7 +400,7 @@ namespace cxxopts
400 help(const std::vector<std::string>& groups = {""}) const; 400 help(const std::vector<std::string>& groups = {""}) const;
401 401
402 private: 402 private:
403 - 403 +
404 void 404 void
405 add_one_option 405 add_one_option
406 ( 406 (
@@ -418,10 +418,10 @@ namespace cxxopts @@ -418,10 +418,10 @@ namespace cxxopts
418 parse_option 418 parse_option
419 ( 419 (
420 std::shared_ptr<OptionDetails> value, 420 std::shared_ptr<OptionDetails> value,
421 - const std::string& name, 421 + const std::string& name,
422 const std::string& arg = "" 422 const std::string& arg = ""
423 ); 423 );
424 - 424 +
425 void 425 void
426 checked_parse_arg 426 checked_parse_arg
427 ( 427 (
@@ -456,8 +456,8 @@ namespace cxxopts @@ -456,8 +456,8 @@ namespace cxxopts
456 456
457 OptionAdder& 457 OptionAdder&
458 operator() 458 operator()
459 - (  
460 - const std::string& opts, 459 + (
  460 + const std::string& opts,
461 const std::string& desc, 461 const std::string& desc,
462 std::shared_ptr<const Value> value 462 std::shared_ptr<const Value> value
463 = ::cxxopts::value<bool>() 463 = ::cxxopts::value<bool>()