From 14ae19c327100c137ec8cb549dfc7447c4888940 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Thu, 14 Feb 2019 14:44:18 +0100 Subject: Autogen: cmQtAutoGen: Store generator names in class static const strings --- Source/cmQtAutoGen.cxx | 47 ++++++++++++++++++++++++++++++----------------- Source/cmQtAutoGen.h | 18 ++++++++++++++---- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index f437138..6e24332 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -11,13 +11,6 @@ #include #include -// - Static variables - -std::string const genNameGen = "AutoGen"; -std::string const genNameMoc = "AutoMoc"; -std::string const genNameUic = "AutoUic"; -std::string const genNameRcc = "AutoRcc"; - // - Static functions /// @brief Merges newOpts into baseOpts @@ -77,27 +70,47 @@ void MergeOptions(std::vector& baseOpts, // - Class definitions -std::string const cmQtAutoGen::ListSep = "<<>>"; unsigned int const cmQtAutoGen::ParallelMax = 64; +std::string const cmQtAutoGen::ListSep = "<<>>"; + +std::string const cmQtAutoGen::GenNameGen = "AutoGen"; +std::string const cmQtAutoGen::GenNameMoc = "AutoMoc"; +std::string const cmQtAutoGen::GenNameUic = "AutoUic"; +std::string const cmQtAutoGen::GenNameRcc = "AutoRcc"; + +std::string const cmQtAutoGen::GenNameGenUpper = "AUTOGEN"; +std::string const cmQtAutoGen::GenNameMocUpper = "AUTOMOC"; +std::string const cmQtAutoGen::GenNameUicUpper = "AUTOUIC"; +std::string const cmQtAutoGen::GenNameRccUpper = "AUTORCC"; -std::string const& cmQtAutoGen::GeneratorName(GeneratorT type) +std::string const& cmQtAutoGen::GeneratorName(GeneratorT genType) { - switch (type) { + switch (genType) { case GeneratorT::GEN: - return genNameGen; + return GenNameGen; case GeneratorT::MOC: - return genNameMoc; + return GenNameMoc; case GeneratorT::UIC: - return genNameUic; + return GenNameUic; case GeneratorT::RCC: - return genNameRcc; + return GenNameRcc; } - return genNameGen; + return GenNameGen; } -std::string cmQtAutoGen::GeneratorNameUpper(GeneratorT genType) +std::string const& cmQtAutoGen::GeneratorNameUpper(GeneratorT genType) { - return cmSystemTools::UpperCase(cmQtAutoGen::GeneratorName(genType)); + switch (genType) { + case GeneratorT::GEN: + return GenNameGenUpper; + case GeneratorT::MOC: + return GenNameMocUpper; + case GeneratorT::UIC: + return GenNameUicUpper; + case GeneratorT::RCC: + return GenNameRccUpper; + } + return GenNameGenUpper; } std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc) diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 96d1946..03dbded 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -14,15 +14,13 @@ class cmQtAutoGen { public: - /// @brief Nested lists separator - static std::string const ListSep; /// @brief Maximum number of parallel threads/processes in a generator static unsigned int const ParallelMax; /// @brief AutoGen generator type enum class GeneratorT { - GEN, // General + GEN, // AUTOGEN MOC, UIC, RCC @@ -54,11 +52,23 @@ public: } }; + /// @brief Nested lists separator + static std::string const ListSep; + // Generator names + static std::string const GenNameGen; + static std::string const GenNameMoc; + static std::string const GenNameUic; + static std::string const GenNameRcc; + static std::string const GenNameGenUpper; + static std::string const GenNameMocUpper; + static std::string const GenNameUicUpper; + static std::string const GenNameRccUpper; + public: /// @brief Returns the generator name static std::string const& GeneratorName(GeneratorT genType); /// @brief Returns the generator name in upper case - static std::string GeneratorNameUpper(GeneratorT genType); + static std::string const& GeneratorNameUpper(GeneratorT genType); /// @brief Returns a string with the requested tool names static std::string Tools(bool moc, bool uic, bool rcc); -- cgit v0.12