untangle includes

- order lexicographically
- include all used headers directly instead of implicit includes
- remove unused header
- move regex include into compile unit
This commit is contained in:
Dennis Luxen 2014-10-14 11:18:10 +02:00
parent 1d9ae57a92
commit 0fe22a5171
2 changed files with 24 additions and 22 deletions

View File

@ -24,6 +24,8 @@ THE SOFTWARE.
#include "cxxopts.hpp" #include "cxxopts.hpp"
#include <regex>
#define OPTION_LONGEST 30 #define OPTION_LONGEST 30
#define OPTION_DESC_GAP 2 #define OPTION_DESC_GAP 2
@ -136,8 +138,8 @@ Options::add_options(std::string group)
OptionAdder& OptionAdder&
OptionAdder::operator() OptionAdder::operator()
( (
const std::string& opts, const std::string& opts,
const std::string& desc, const std::string& desc,
std::shared_ptr<const Value> value std::shared_ptr<const Value> value
) )
@ -162,7 +164,7 @@ void
Options::parse_option Options::parse_option
( (
std::shared_ptr<OptionDetails> value, std::shared_ptr<OptionDetails> value,
const std::string& name, const std::string& name,
const std::string& arg const std::string& arg
) )
{ {
@ -291,7 +293,7 @@ Options::parse(int& argc, char**& argv)
else if (result[1].length() != 0) else if (result[1].length() != 0)
{ {
std::string name = result[1]; std::string name = result[1];
auto iter = m_options.find(name); auto iter = m_options.find(name);
if (iter == m_options.end()) if (iter == m_options.end())
@ -343,8 +345,8 @@ void
Options::add_option Options::add_option
( (
const std::string& group, const std::string& group,
const std::string& s, const std::string& s,
const std::string& l, const std::string& l,
const std::string& desc, const std::string& desc,
std::shared_ptr<const Value> value std::shared_ptr<const Value> value
) )
@ -397,7 +399,7 @@ Options::help_one_group(const std::string& g) const
size_t longest = 0; size_t longest = 0;
std::string result; std::string result;
if (!g.empty()) if (!g.empty())
{ {
result += " " + g + " options:\n\n"; result += " " + g + " options:\n\n";
@ -443,7 +445,7 @@ Options::help_one_group(const std::string& g) const
std::string std::string
Options::help(const std::vector<std::string>& groups) const Options::help(const std::vector<std::string>& groups) const
{ {
std::string result = "Usage:\n " + m_program + " [OPTION...] " std::string result = "Usage:\n " + m_program + " [OPTION...] "
+ m_help_string + "\n\n"; + m_help_string + "\n\n";
for (const auto& g : groups) for (const auto& g : groups)

View File

@ -22,13 +22,13 @@ THE SOFTWARE.
*/ */
#include <regex>
#include <set>
#include <map>
#include <exception> #include <exception>
#include <sstream>
#include <iostream> #include <iostream>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
namespace cxxopts namespace cxxopts
{ {
@ -130,7 +130,7 @@ namespace cxxopts
public: public:
option_not_has_argument_exception option_not_has_argument_exception
( (
const std::string& option, const std::string& option,
const std::string& arg const std::string& arg
) )
: OptionParseException( : OptionParseException(
@ -288,7 +288,7 @@ namespace cxxopts
{ {
} }
const std::string& const std::string&
description() const description() const
{ {
return m_desc; return m_desc;
@ -361,8 +361,8 @@ namespace cxxopts
add_option add_option
( (
const std::string& group, const std::string& group,
const std::string& s, const std::string& s,
const std::string& l, const std::string& l,
const std::string& desc, const std::string& desc,
std::shared_ptr<const Value> value std::shared_ptr<const Value> value
); );
@ -400,7 +400,7 @@ namespace cxxopts
help(const std::vector<std::string>& groups = {""}) const; help(const std::vector<std::string>& groups = {""}) const;
private: private:
void void
add_one_option add_one_option
( (
@ -418,10 +418,10 @@ namespace cxxopts
parse_option parse_option
( (
std::shared_ptr<OptionDetails> value, std::shared_ptr<OptionDetails> value,
const std::string& name, const std::string& name,
const std::string& arg = "" const std::string& arg = ""
); );
void void
checked_parse_arg checked_parse_arg
( (
@ -456,8 +456,8 @@ namespace cxxopts
OptionAdder& OptionAdder&
operator() operator()
( (
const std::string& opts, const std::string& opts,
const std::string& desc, const std::string& desc,
std::shared_ptr<const Value> value std::shared_ptr<const Value> value
= ::cxxopts::value<bool>() = ::cxxopts::value<bool>()