diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-09-19 13:11:55 +0200 |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-09-20 13:27:30 +0200 |
commit | 0aa8a2ab8b00c0889df3d0fa1be47ad5a0b9db22 (patch) | |
tree | 707ea2e27d95ba423c5710bb4ecd42bce5e91023 /Source/CTest/cmCTestUploadCommand.cxx | |
parent | d5a6a133680e4d5798522a4b29ae6bced1f2db3a (diff) | |
download | cmake-0aa8a2ab8b00c0889df3d0fa1be47ad5a0b9db22.tar.gz |
cmCTest*Command: Port to cmArgumentParser
Diffstat (limited to 'Source/CTest/cmCTestUploadCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestUploadCommand.cxx | 64 |
1 files changed, 24 insertions, 40 deletions
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 59fbf371c4..91808212c4 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -2,61 +2,45 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCTestUploadCommand.h" +#include <set> #include <sstream> #include <vector> +#include "cmAlgorithms.h" #include "cmCTest.h" #include "cmCTestUploadHandler.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmSystemTools.h" +#include "cm_static_string_view.hxx" -cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler() -{ - cmCTestUploadHandler* handler = this->CTest->GetUploadHandler(); - handler->Initialize(); - handler->SetFiles(this->Files); - handler->SetQuiet(this->Quiet); - return handler; -} - -bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg) +void cmCTestUploadCommand::BindArguments() { - if (arg == "FILES") { - this->ArgumentDoing = ArgumentDoingFiles; - return true; - } - if (arg == "QUIET") { - this->ArgumentDoing = ArgumentDoingNone; - this->Quiet = true; - return true; - } - if (arg == "CAPTURE_CMAKE_ERROR") { - this->ArgumentDoing = ArgumentDoingCaptureCMakeError; - return true; - } - return false; + this->Bind("FILES"_s, this->Files); + this->Bind("QUIET"_s, this->Quiet); + this->Bind("CAPTURE_CMAKE_ERROR"_s, this->CaptureCMakeError); } -bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) +void cmCTestUploadCommand::CheckArguments(std::vector<std::string> const&) { - if (this->ArgumentDoing == ArgumentDoingCaptureCMakeError) { - this->Values[ct_CAPTURE_CMAKE_ERROR] = arg.c_str(); - return true; - } - if (this->ArgumentDoing == ArgumentDoingFiles) { - if (cmSystemTools::FileExists(arg)) { - this->Files.insert(arg); + cmEraseIf(this->Files, [this](std::string const& arg) -> bool { + if (!cmSystemTools::FileExists(arg)) { + std::ostringstream e; + e << "File \"" << arg << "\" does not exist. Cannot submit " + << "a non-existent file."; + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return true; } - std::ostringstream e; - e << "File \"" << arg << "\" does not exist. Cannot submit " - << "a non-existent file."; - this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); - this->ArgumentDoing = ArgumentDoingError; return false; - } + }); +} - // Look for other arguments. - return this->Superclass::CheckArgumentValue(arg); +cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler() +{ + cmCTestUploadHandler* handler = this->CTest->GetUploadHandler(); + handler->Initialize(); + handler->SetFiles( + std::set<std::string>(this->Files.begin(), this->Files.end())); + handler->SetQuiet(this->Quiet); + return handler; } |