cmArgumentParser: Remove unnecessary local names for common types

This commit is contained in:
Brad King
2022-06-29 15:41:22 -04:00
parent 2873f41bd9
commit f3dbf4b89d
2 changed files with 5 additions and 8 deletions

View File

@@ -44,14 +44,14 @@ void Instance::Bind(std::string& val)
this->ExpectValue = true;
}
void Instance::Bind(StringList& val)
void Instance::Bind(std::vector<std::string>& val)
{
this->CurrentString = nullptr;
this->CurrentList = &val;
this->ExpectValue = true;
}
void Instance::Bind(MultiStringList& val)
void Instance::Bind(std::vector<std::vector<std::string>>& val)
{
this->CurrentString = nullptr;
this->CurrentList = (static_cast<void>(val.emplace_back()), &val.back());

View File

@@ -15,9 +15,6 @@
namespace ArgumentParser {
using StringList = std::vector<std::string>;
using MultiStringList = std::vector<StringList>;
class Instance;
using Action = std::function<void(Instance&, void*)>;
@@ -39,8 +36,8 @@ public:
void Bind(bool& val);
void Bind(std::string& val);
void Bind(StringList& val);
void Bind(MultiStringList& val);
void Bind(std::vector<std::string>& val);
void Bind(std::vector<std::vector<std::string>>& val);
void Consume(cm::string_view arg, void* result,
std::vector<std::string>* unparsedArguments,
@@ -50,7 +47,7 @@ public:
private:
ActionMap const& Bindings;
std::string* CurrentString = nullptr;
StringList* CurrentList = nullptr;
std::vector<std::string>* CurrentList = nullptr;
bool ExpectValue = false;
};