summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommand.cxx
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2021-11-01 14:19:05 (GMT)
committerBrad King <brad.king@kitware.com>2021-11-18 17:02:37 (GMT)
commit9b31a977481ea07c979549246ee46946e9978e08 (patch)
tree07b8d6b8618140ed066c8b1d3efe37c0bd994233 /Source/cmCustomCommand.cxx
parentd0158b765b0660bcfe304830e179fa9bbdffd5d9 (diff)
downloadCMake-9b31a977481ea07c979549246ee46946e9978e08.zip
CMake-9b31a977481ea07c979549246ee46946e9978e08.tar.gz
CMake-9b31a977481ea07c979549246ee46946e9978e08.tar.bz2
cmCustomCommand: Move constructor arguments to individual setters
Make `cmCustomCommand` have just only default constructor. Use each setter instead. This follows the builder pattern. Introduce `cc::SetOutputs(std::string output)`. This will be used later, as substitution for `cc::SetOutputs({output})`.
Diffstat (limited to 'Source/cmCustomCommand.cxx')
-rw-r--r--Source/cmCustomCommand.cxx53
1 files changed, 35 insertions, 18 deletions
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index ec60ff7..f009632 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -6,28 +6,19 @@
#include <cmext/algorithm>
-cmCustomCommand::cmCustomCommand(std::vector<std::string> outputs,
- std::vector<std::string> byproducts,
- std::vector<std::string> depends,
- cmCustomCommandLines commandLines,
- cmListFileBacktrace lfbt, const char* comment,
- const char* workingDirectory,
- bool stdPipesUTF8)
- : Outputs(std::move(outputs))
- , Byproducts(std::move(byproducts))
- , Depends(std::move(depends))
- , CommandLines(std::move(commandLines))
- , Backtrace(std::move(lfbt))
- , Comment(comment ? comment : "")
- , WorkingDirectory(workingDirectory ? workingDirectory : "")
- , HaveComment(comment != nullptr)
- , StdPipesUTF8(stdPipesUTF8)
+const std::vector<std::string>& cmCustomCommand::GetOutputs() const
{
+ return this->Outputs;
}
-const std::vector<std::string>& cmCustomCommand::GetOutputs() const
+void cmCustomCommand::SetOutputs(std::vector<std::string> outputs)
{
- return this->Outputs;
+ this->Outputs = std::move(outputs);
+}
+
+void cmCustomCommand::SetOutputs(std::string output)
+{
+ this->Outputs = { std::move(output) };
}
const std::vector<std::string>& cmCustomCommand::GetByproducts() const
@@ -35,22 +26,43 @@ const std::vector<std::string>& cmCustomCommand::GetByproducts() const
return this->Byproducts;
}
+void cmCustomCommand::SetByproducts(std::vector<std::string> byproducts)
+{
+ this->Byproducts = std::move(byproducts);
+}
+
const std::vector<std::string>& cmCustomCommand::GetDepends() const
{
return this->Depends;
}
+void cmCustomCommand::SetDepends(std::vector<std::string> depends)
+{
+ Depends = std::move(depends);
+}
+
const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
{
return this->CommandLines;
}
+void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines)
+{
+ this->CommandLines = std::move(commandLines);
+}
+
const char* cmCustomCommand::GetComment() const
{
const char* no_comment = nullptr;
return this->HaveComment ? this->Comment.c_str() : no_comment;
}
+void cmCustomCommand::SetComment(const char* comment)
+{
+ this->Comment = comment ? comment : "";
+ this->HaveComment = (comment != nullptr);
+}
+
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
{
cm::append(this->CommandLines, commandLines);
@@ -86,6 +98,11 @@ cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
return this->Backtrace;
}
+void cmCustomCommand::SetBacktrace(cmListFileBacktrace lfbt)
+{
+ this->Backtrace = std::move(lfbt);
+}
+
cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const
{
return this->ImplicitDepends;