mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-27 03:08:35 -06:00
Autogen: Move Logger and FileSystem member variables to generator classes
`cmQtAutoGenerator` automatically added `cmQtAutoGenerator::Logger` and `cmQtAutoGenerator::FileSystem` member variables to all inherited classes. This patch moves these members variable declarations to the inherited classes, where needed.
This commit is contained in:
@@ -20,6 +20,34 @@
|
||||
|
||||
// -- Class methods
|
||||
|
||||
cmQtAutoGenerator::Logger::Logger()
|
||||
{
|
||||
// Initialize logger
|
||||
{
|
||||
std::string verbose;
|
||||
if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) {
|
||||
unsigned long iVerbose = 0;
|
||||
if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) {
|
||||
SetVerbosity(static_cast<unsigned int>(iVerbose));
|
||||
} else {
|
||||
// Non numeric verbosity
|
||||
SetVerbose(cmSystemTools::IsOn(verbose));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
std::string colorEnv;
|
||||
cmSystemTools::GetEnv("COLOR", colorEnv);
|
||||
if (!colorEnv.empty()) {
|
||||
SetColorOutput(cmSystemTools::IsOn(colorEnv));
|
||||
} else {
|
||||
SetColorOutput(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmQtAutoGenerator::Logger::~Logger() = default;
|
||||
|
||||
void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value)
|
||||
{
|
||||
unsigned long verbosity = 0;
|
||||
@@ -670,31 +698,7 @@ void cmQtAutoGenerator::ReadOnlyProcessT::UVTryFinish()
|
||||
}
|
||||
|
||||
cmQtAutoGenerator::cmQtAutoGenerator()
|
||||
: FileSys_(&Logger_)
|
||||
{
|
||||
// Initialize logger
|
||||
{
|
||||
std::string verbose;
|
||||
if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) {
|
||||
unsigned long iVerbose = 0;
|
||||
if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) {
|
||||
Logger_.SetVerbosity(static_cast<unsigned int>(iVerbose));
|
||||
} else {
|
||||
// Non numeric verbosity
|
||||
Logger_.SetVerbose(cmSystemTools::IsOn(verbose));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
std::string colorEnv;
|
||||
cmSystemTools::GetEnv("COLOR", colorEnv);
|
||||
if (!colorEnv.empty()) {
|
||||
Logger_.SetColorOutput(cmSystemTools::IsOn(colorEnv));
|
||||
} else {
|
||||
Logger_.SetColorOutput(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize libuv loop
|
||||
uv_disable_stdio_inheritance();
|
||||
#ifdef CMAKE_UV_SIGNAL_HACK
|
||||
|
||||
@@ -31,12 +31,16 @@ public:
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
// -- Construction
|
||||
Logger();
|
||||
~Logger();
|
||||
// -- Verbosity
|
||||
unsigned int Verbosity() const { return this->Verbosity_; }
|
||||
void SetVerbosity(unsigned int value) { this->Verbosity_ = value; }
|
||||
void RaiseVerbosity(std::string const& value);
|
||||
bool Verbose() const { return (this->Verbosity_ != 0); }
|
||||
void SetVerbose(bool value) { this->Verbosity_ = value ? 1 : 0; }
|
||||
// -- Color output
|
||||
bool ColorOutput() const { return this->ColorOutput_; }
|
||||
void SetColorOutput(bool value);
|
||||
// -- Log info
|
||||
@@ -258,11 +262,6 @@ public:
|
||||
// -- Run
|
||||
bool Run(std::string const& infoFile, std::string const& config);
|
||||
|
||||
// -- Accessors
|
||||
// Logging
|
||||
Logger& Log() { return Logger_; }
|
||||
// File System
|
||||
FileSystem& FileSys() { return FileSys_; }
|
||||
// InfoFile
|
||||
std::string const& InfoFile() const { return InfoFile_; }
|
||||
std::string const& InfoDir() const { return InfoDir_; }
|
||||
@@ -280,9 +279,6 @@ protected:
|
||||
virtual bool Process() = 0;
|
||||
|
||||
private:
|
||||
// -- Logging
|
||||
Logger Logger_;
|
||||
FileSystem FileSys_;
|
||||
// -- Info settings
|
||||
std::string InfoFile_;
|
||||
std::string InfoDir_;
|
||||
|
||||
@@ -1126,7 +1126,8 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessFinished()
|
||||
}
|
||||
|
||||
cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic()
|
||||
: Base_(&FileSys())
|
||||
: FileSys_(&Logger_)
|
||||
, Base_(&FileSys())
|
||||
, Moc_(&FileSys())
|
||||
{
|
||||
// Precompile regular expressions
|
||||
|
||||
@@ -387,6 +387,9 @@ public:
|
||||
void ParallelMocAutoUpdated();
|
||||
|
||||
private:
|
||||
// -- Utility accessors
|
||||
Logger& Log() { return Logger_; }
|
||||
FileSystem& FileSys() { return FileSys_; }
|
||||
// -- Abstract processing interface
|
||||
bool Init(cmMakefile* makefile) override;
|
||||
bool Process() override;
|
||||
@@ -407,6 +410,9 @@ private:
|
||||
void MocGenerateCompilation();
|
||||
|
||||
private:
|
||||
// -- Utility
|
||||
Logger Logger_;
|
||||
FileSystem FileSys_;
|
||||
// -- Settings
|
||||
BaseSettingsT Base_;
|
||||
MocSettingsT Moc_;
|
||||
|
||||
@@ -25,6 +25,11 @@ public:
|
||||
cmQtAutoGeneratorRcc& operator=(cmQtAutoGeneratorRcc const&) = delete;
|
||||
|
||||
private:
|
||||
// -- Utility
|
||||
Logger& Log() { return Logger_; }
|
||||
bool IsMultiConfig() const { return MultiConfig_; }
|
||||
std::string MultiConfigOutput() const;
|
||||
|
||||
// -- Abstract processing interface
|
||||
bool Init(cmMakefile* makefile) override;
|
||||
bool Process() override;
|
||||
@@ -39,11 +44,9 @@ private:
|
||||
bool GenerateRcc();
|
||||
bool GenerateWrapper();
|
||||
|
||||
// -- Utility
|
||||
bool IsMultiConfig() const { return MultiConfig_; }
|
||||
std::string MultiConfigOutput() const;
|
||||
|
||||
private:
|
||||
// -- Logging
|
||||
Logger Logger_;
|
||||
// -- Config settings
|
||||
bool MultiConfig_ = false;
|
||||
// -- Directories
|
||||
|
||||
Reference in New Issue
Block a user