summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-04-06 09:43:21 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-04-06 15:37:12 (GMT)
commitf161cfe5a8fa00d6d203885e9c1985ec53d7d625 (patch)
tree422ddf42ba2cacdd9bb150960c19598991e0f624
parent7baec5e94b372cfc21e777488ecf993e4bce368e (diff)
downloadCMake-f161cfe5a8fa00d6d203885e9c1985ec53d7d625.zip
CMake-f161cfe5a8fa00d6d203885e9c1985ec53d7d625.tar.gz
CMake-f161cfe5a8fa00d6d203885e9c1985ec53d7d625.tar.bz2
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.
-rw-r--r--Source/cmQtAutoGenerator.cxx52
-rw-r--r--Source/cmQtAutoGenerator.h12
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx3
-rw-r--r--Source/cmQtAutoGeneratorMocUic.h6
-rw-r--r--Source/cmQtAutoGeneratorRcc.h11
5 files changed, 47 insertions, 37 deletions
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index f56f7c9..c1e6aab 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -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
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 17170d7..2993946 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -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_;
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index 0982473..607576f 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -1126,7 +1126,8 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessFinished()
}
cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic()
- : Base_(&FileSys())
+ : FileSys_(&Logger_)
+ , Base_(&FileSys())
, Moc_(&FileSys())
{
// Precompile regular expressions
diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h
index e48d7f3..cc785a7 100644
--- a/Source/cmQtAutoGeneratorMocUic.h
+++ b/Source/cmQtAutoGeneratorMocUic.h
@@ -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_;
diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoGeneratorRcc.h
index d831f1f..ff7a02a 100644
--- a/Source/cmQtAutoGeneratorRcc.h
+++ b/Source/cmQtAutoGeneratorRcc.h
@@ -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