summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmQtAutoGenerator.cxx')
-rw-r--r--Source/cmQtAutoGenerator.cxx49
1 files changed, 15 insertions, 34 deletions
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index e1c435b..90361a9 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -1,16 +1,17 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQtAutoGenerator.h"
-#include "cmQtAutoGen.h"
+#include "cm_memory.hxx"
#include "cmsys/FStream.hxx"
-#include "cmAlgorithms.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmQtAutoGen.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -21,11 +22,11 @@ cmQtAutoGenerator::Logger::Logger()
std::string verbose;
if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) {
unsigned long iVerbose = 0;
- if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) {
+ if (cmStrToULong(verbose, &iVerbose)) {
SetVerbosity(static_cast<unsigned int>(iVerbose));
} else {
// Non numeric verbosity
- SetVerbose(cmSystemTools::IsOn(verbose));
+ SetVerbose(cmIsOn(verbose));
}
}
}
@@ -33,7 +34,7 @@ cmQtAutoGenerator::Logger::Logger()
std::string colorEnv;
cmSystemTools::GetEnv("COLOR", colorEnv);
if (!colorEnv.empty()) {
- SetColorOutput(cmSystemTools::IsOn(colorEnv));
+ SetColorOutput(cmIsOn(colorEnv));
} else {
SetColorOutput(true);
}
@@ -45,7 +46,7 @@ cmQtAutoGenerator::Logger::~Logger() = default;
void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value)
{
unsigned long verbosity = 0;
- if (cmSystemTools::StringToULong(value.c_str(), &verbosity)) {
+ if (cmStrToULong(value, &verbosity)) {
if (this->Verbosity_ < verbosity) {
this->Verbosity_ = static_cast<unsigned int>(verbosity);
}
@@ -59,19 +60,13 @@ void cmQtAutoGenerator::Logger::SetColorOutput(bool value)
std::string cmQtAutoGenerator::Logger::HeadLine(std::string const& title)
{
- std::string head = title;
- head += '\n';
- head.append(head.size() - 1, '-');
- head += '\n';
- return head;
+ return cmStrCat(title, "\n", std::string(title.size(), '-'), "\n");
}
void cmQtAutoGenerator::Logger::Info(GenT genType,
std::string const& message) const
{
- std::string msg = GeneratorName(genType);
- msg += ": ";
- msg += message;
+ std::string msg = cmStrCat(GeneratorName(genType), ": ", message);
if (msg.back() != '\n') {
msg.push_back('\n');
}
@@ -109,19 +104,13 @@ void cmQtAutoGenerator::Logger::WarningFile(GenT genType,
std::string const& filename,
std::string const& message) const
{
- std::string msg = " ";
- msg += Quoted(filename);
- msg.push_back('\n');
- // Message
- msg += message;
- Warning(genType, msg);
+ Warning(genType, cmStrCat(" ", Quoted(filename), "\n", message));
}
void cmQtAutoGenerator::Logger::Error(GenT genType,
std::string const& message) const
{
- std::string msg;
- msg += HeadLine(GeneratorName(genType) + " error");
+ std::string msg = HeadLine(GeneratorName(genType) + " error");
// Message
msg += message;
if (msg.back() != '\n') {
@@ -138,12 +127,7 @@ void cmQtAutoGenerator::Logger::ErrorFile(GenT genType,
std::string const& filename,
std::string const& message) const
{
- std::string emsg = " ";
- emsg += Quoted(filename);
- emsg += '\n';
- // Message
- emsg += message;
- Error(genType, emsg);
+ Error(genType, cmStrCat(" ", Quoted(filename), '\n', message));
}
void cmQtAutoGenerator::Logger::ErrorCommand(
@@ -279,10 +263,8 @@ bool cmQtAutoGenerator::Run(std::string const& infoFile,
InfoFile_ = infoFile;
cmSystemTools::ConvertToUnixSlashes(InfoFile_);
if (!InfoFileTime_.Load(InfoFile_)) {
- std::string msg = "AutoGen: The info file ";
- msg += Quoted(InfoFile_);
- msg += " is not readable\n";
- cmSystemTools::Stderr(msg);
+ cmSystemTools::Stderr(cmStrCat("AutoGen: The info file ",
+ Quoted(InfoFile_), " is not readable\n"));
return false;
}
InfoDir_ = cmSystemTools::GetFilenamePath(infoFile);
@@ -316,8 +298,7 @@ bool cmQtAutoGenerator::Run(std::string const& infoFile,
std::string cmQtAutoGenerator::SettingsFind(std::string const& content,
const char* key)
{
- std::string prefix(key);
- prefix += ':';
+ std::string prefix = cmStrCat(key, ':');
std::string::size_type pos = content.find(prefix);
if (pos != std::string::npos) {
pos += prefix.size();