summaryrefslogtreecommitdiffstats
path: root/Source/cmArgumentParser.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-17 16:48:59 (GMT)
committerBrad King <brad.king@kitware.com>2022-07-20 20:03:12 (GMT)
commit197ef69aa1758040ccf8a01dd0a9be6ddb8f8c17 (patch)
tree33a19c811cb610e08a4aa6cf2bca26108701df4f /Source/cmArgumentParser.cxx
parente98fd9d87ecbc231632653b2f3b31d8a01864874 (diff)
downloadCMake-197ef69aa1758040ccf8a01dd0a9be6ddb8f8c17.zip
CMake-197ef69aa1758040ccf8a01dd0a9be6ddb8f8c17.tar.gz
CMake-197ef69aa1758040ccf8a01dd0a9be6ddb8f8c17.tar.bz2
cmArgumentParser: Simplify internal method signatures
Record `Parse` parameters during construction of the internal instance instead of passing them to every method.
Diffstat (limited to 'Source/cmArgumentParser.cxx')
-rw-r--r--Source/cmArgumentParser.cxx23
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx
index f0c4cfc..355cfdc 100644
--- a/Source/cmArgumentParser.cxx
+++ b/Source/cmArgumentParser.cxx
@@ -74,19 +74,16 @@ void Instance::Bind(std::vector<std::vector<std::string>>& val)
this->ExpectValue = false;
}
-void Instance::Consume(cm::string_view arg, void* result,
- std::vector<std::string>* unparsedArguments,
- std::vector<cm::string_view>* keywordsMissingValue,
- std::vector<cm::string_view>* parsedKeywords)
+void Instance::Consume(cm::string_view arg)
{
auto const it = this->Bindings.Find(arg);
if (it != this->Bindings.end()) {
- if (parsedKeywords != nullptr) {
- parsedKeywords->emplace_back(it->first);
+ if (this->ParsedKeywords != nullptr) {
+ this->ParsedKeywords->emplace_back(it->first);
}
- it->second(*this, result);
- if (this->ExpectValue && keywordsMissingValue != nullptr) {
- keywordsMissingValue->emplace_back(it->first);
+ it->second(*this);
+ if (this->ExpectValue && this->KeywordsMissingValue != nullptr) {
+ this->KeywordsMissingValue->emplace_back(it->first);
}
return;
}
@@ -97,13 +94,13 @@ void Instance::Consume(cm::string_view arg, void* result,
this->CurrentList = nullptr;
} else if (this->CurrentList != nullptr) {
this->CurrentList->emplace_back(arg);
- } else if (unparsedArguments != nullptr) {
- unparsedArguments->emplace_back(arg);
+ } else if (this->UnparsedArguments != nullptr) {
+ this->UnparsedArguments->emplace_back(arg);
}
if (this->ExpectValue) {
- if (keywordsMissingValue != nullptr) {
- keywordsMissingValue->pop_back();
+ if (this->KeywordsMissingValue != nullptr) {
+ this->KeywordsMissingValue->pop_back();
}
this->ExpectValue = false;
}