From b32e18fb88434d3f9d58447212ee33a51430c144 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 2 Apr 2019 19:11:19 +0200 Subject: Autogen: Remove static const generator name strings from cmQtAutoGen --- Source/cmQtAutoGen.cxx | 46 ++++++++++++++++----------------- Source/cmQtAutoGen.h | 9 ------- Source/cmQtAutoGenGlobalInitializer.cxx | 6 ++--- Source/cmQtAutoGenGlobalInitializer.h | 4 +-- 4 files changed, 28 insertions(+), 37 deletions(-) diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 87ef112..d71d82f 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -73,44 +73,44 @@ void MergeOptions(std::vector& baseOpts, unsigned int const cmQtAutoGen::ParallelMax = 64; std::string const cmQtAutoGen::ListSep = "<<>>"; -std::string const cmQtAutoGen::GenAutoGen = "AutoGen"; -std::string const cmQtAutoGen::GenAutoMoc = "AutoMoc"; -std::string const cmQtAutoGen::GenAutoUic = "AutoUic"; -std::string const cmQtAutoGen::GenAutoRcc = "AutoRcc"; - -std::string const cmQtAutoGen::GenAUTOGEN = "AUTOGEN"; -std::string const cmQtAutoGen::GenAUTOMOC = "AUTOMOC"; -std::string const cmQtAutoGen::GenAUTOUIC = "AUTOUIC"; -std::string const cmQtAutoGen::GenAUTORCC = "AUTORCC"; - std::string const& cmQtAutoGen::GeneratorName(GenT genType) { + static const std::string AutoGen("AutoGen"); + static const std::string AutoMoc("AutoMoc"); + static const std::string AutoUic("AutoUic"); + static const std::string AutoRcc("AutoRcc"); + switch (genType) { case GenT::GEN: - return GenAutoGen; + return AutoGen; case GenT::MOC: - return GenAutoMoc; + return AutoMoc; case GenT::UIC: - return GenAutoUic; + return AutoUic; case GenT::RCC: - return GenAutoRcc; + return AutoRcc; } - return GenAutoGen; + return AutoGen; } std::string const& cmQtAutoGen::GeneratorNameUpper(GenT genType) { + static const std::string AUTOGEN("AUTOGEN"); + static const std::string AUTOMOC("AUTOMOC"); + static const std::string AUTOUIC("AUTOUIC"); + static const std::string AUTORCC("AUTORCC"); + switch (genType) { case GenT::GEN: - return GenAUTOGEN; + return AUTOGEN; case GenT::MOC: - return GenAUTOMOC; + return AUTOMOC; case GenT::UIC: - return GenAUTOUIC; + return AUTOUIC; case GenT::RCC: - return GenAUTORCC; + return AUTORCC; } - return GenAUTOGEN; + return AUTOGEN; } std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc) @@ -118,13 +118,13 @@ std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc) std::string res; std::vector lst; if (moc) { - lst.emplace_back(GenAUTOMOC); + lst.emplace_back("AUTOMOC"); } if (uic) { - lst.emplace_back(GenAUTOUIC); + lst.emplace_back("AUTOUIC"); } if (rcc) { - lst.emplace_back(GenAUTORCC); + lst.emplace_back("AUTORCC"); } switch (lst.size()) { case 1: diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 6cc8df1..d127a71 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -51,15 +51,6 @@ public: /// @brief Nested lists separator static std::string const ListSep; - // Generator names - static std::string const GenAutoGen; - static std::string const GenAutoMoc; - static std::string const GenAutoUic; - static std::string const GenAutoRcc; - static std::string const GenAUTOGEN; - static std::string const GenAUTOMOC; - static std::string const GenAUTOUIC; - static std::string const GenAUTORCC; /// @brief Maximum number of parallel threads/processes in a generator static unsigned int const ParallelMax; diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 994cfc8..ab51570 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -81,9 +81,9 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( continue; } - bool const moc = target->GetPropertyAsBool(cmQtAutoGen::GenAUTOMOC); - bool const uic = target->GetPropertyAsBool(cmQtAutoGen::GenAUTOUIC); - bool const rcc = target->GetPropertyAsBool(cmQtAutoGen::GenAUTORCC); + bool const moc = target->GetPropertyAsBool(kw().AUTOMOC); + bool const uic = target->GetPropertyAsBool(kw().AUTOUIC); + bool const rcc = target->GetPropertyAsBool(kw().AUTORCC); if (moc || uic || rcc) { std::string const mocExec = target->GetSafeProperty("AUTOMOC_EXECUTABLE"); diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h index 6cddf16..76ed76b 100644 --- a/Source/cmQtAutoGenGlobalInitializer.h +++ b/Source/cmQtAutoGenGlobalInitializer.h @@ -34,7 +34,7 @@ public: std::vector const& localGenerators); ~cmQtAutoGenGlobalInitializer(); - Keywords const* kw() const { return Keywords_.get(); }; + Keywords const& kw() const { return Keywords_; }; bool generate(); @@ -62,7 +62,7 @@ private: std::map GlobalAutoGenTargets_; std::map GlobalAutoRccTargets_; std::unordered_map ExecutableTestOutputs_; - std::unique_ptr Keywords_; + Keywords const Keywords_; }; #endif -- cgit v0.12