parent
834fb9999b
commit
ed85f04a1b
@ -82,7 +82,7 @@ namespace cxxopts
|
||||
|
||||
namespace cxxopts
|
||||
{
|
||||
typedef icu::UnicodeString String;
|
||||
using String = icu::UnicodeString;
|
||||
|
||||
inline
|
||||
String
|
||||
@ -217,7 +217,7 @@ namespace std
|
||||
|
||||
namespace cxxopts
|
||||
{
|
||||
typedef std::string String;
|
||||
using String = std::string;
|
||||
|
||||
template <typename T>
|
||||
T
|
||||
@ -562,7 +562,7 @@ namespace cxxopts
|
||||
{
|
||||
template <typename U>
|
||||
void
|
||||
operator()(bool, U, const std::string&) {}
|
||||
operator()(bool, U, const std::string&) const {}
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
@ -1030,9 +1030,9 @@ namespace cxxopts
|
||||
|
||||
OptionDetails(const OptionDetails& rhs)
|
||||
: m_desc(rhs.m_desc)
|
||||
, m_value(rhs.m_value->clone())
|
||||
, m_count(rhs.m_count)
|
||||
{
|
||||
m_value = rhs.m_value->clone();
|
||||
}
|
||||
|
||||
OptionDetails(OptionDetails&& rhs) = default;
|
||||
@ -1236,8 +1236,7 @@ namespace cxxopts
|
||||
{
|
||||
public:
|
||||
|
||||
ParseResult() {}
|
||||
|
||||
ParseResult() = default;
|
||||
ParseResult(const ParseResult&) = default;
|
||||
|
||||
ParseResult(NameHashMap&& keys, ParsedHashMap&& values, std::vector<KeyValue> sequential, std::vector<std::string>&& unmatched_args)
|
||||
@ -1840,9 +1839,9 @@ OptionParser::consume_positional(const std::string& a, PositionalListIterator& n
|
||||
auto iter = m_options.find(*next);
|
||||
if (iter != m_options.end())
|
||||
{
|
||||
auto& result = m_parsed[iter->second->hash()];
|
||||
if (!iter->second->value().is_container())
|
||||
{
|
||||
auto& result = m_parsed[iter->second->hash()];
|
||||
if (result.count() == 0)
|
||||
{
|
||||
add_to_option(iter, *next, a);
|
||||
@ -1898,7 +1897,7 @@ OptionParser::parse(int argc, const char* const* argv)
|
||||
{
|
||||
int current = 1;
|
||||
bool consume_remaining = false;
|
||||
PositionalListIterator next_positional = m_positional.begin();
|
||||
auto next_positional = m_positional.begin();
|
||||
|
||||
std::vector<std::string> unmatched;
|
||||
|
||||
@ -1932,7 +1931,7 @@ OptionParser::parse(int argc, const char* const* argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
unmatched.push_back(argv[current]);
|
||||
unmatched.emplace_back(argv[current]);
|
||||
}
|
||||
//if we return from here then it was parsed successfully, so continue
|
||||
}
|
||||
@ -1987,7 +1986,7 @@ OptionParser::parse(int argc, const char* const* argv)
|
||||
if (m_allow_unrecognised)
|
||||
{
|
||||
// keep unrecognised options in argument list, skip to next argument
|
||||
unmatched.push_back(argv[current]);
|
||||
unmatched.emplace_back(argv[current]);
|
||||
++current;
|
||||
continue;
|
||||
}
|
||||
@ -2040,7 +2039,7 @@ OptionParser::parse(int argc, const char* const* argv)
|
||||
|
||||
//adjust argv for any that couldn't be swallowed
|
||||
while (current != argc) {
|
||||
unmatched.push_back(argv[current]);
|
||||
unmatched.emplace_back(argv[current]);
|
||||
++current;
|
||||
}
|
||||
}
|
||||
@ -2235,12 +2234,16 @@ void
|
||||
Options::generate_all_groups_help(String& result) const
|
||||
{
|
||||
std::vector<std::string> all_groups;
|
||||
all_groups.reserve(m_help.size());
|
||||
|
||||
for (const auto& group : m_help)
|
||||
{
|
||||
all_groups.push_back(group.first);
|
||||
}
|
||||
std::transform(
|
||||
m_help.begin(),
|
||||
m_help.end(),
|
||||
std::back_inserter(all_groups),
|
||||
[] (const std::map<std::string, HelpGroupDetails>::value_type& group)
|
||||
{
|
||||
return group.first;
|
||||
}
|
||||
);
|
||||
|
||||
generate_group_help(result, all_groups);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user