From 5431395d68a44d42149fb93692636f4138ddf6ed Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 2 Apr 2019 18:53:34 +0200 Subject: Autogen: Add cmQtAutogenGlobalInitializer::Keywords class The new `cmQtAutogenGlobalInitializer::Keywords` class instance is bound to the lifetime of the `cmQtAutogenGlobalInitializer` instance. Global static const strings would be allocated at program start and deallocated at program end. Keeping keyword strings alive only in the context where they're needed helps to reduce the memory footprint. --- Source/cmQtAutoGenGlobalInitializer.cxx | 7 +++++++ Source/cmQtAutoGenGlobalInitializer.h | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 7bd0e52..994cfc8 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -20,6 +20,13 @@ #include #include +cmQtAutoGenGlobalInitializer::Keywords::Keywords() + : AUTOMOC("AUTOMOC") + , AUTOUIC("AUTOUIC") + , AUTORCC("AUTORCC") +{ +} + cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( std::vector const& localGenerators) { diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h index 74184a0..6cddf16 100644 --- a/Source/cmQtAutoGenGlobalInitializer.h +++ b/Source/cmQtAutoGenGlobalInitializer.h @@ -18,10 +18,24 @@ class cmQtAutoGenInitializer; class cmQtAutoGenGlobalInitializer { public: + /// @brief Collection of QtAutogen related keywords + class Keywords + { + public: + Keywords(); + + std::string AUTOMOC; + std::string AUTOUIC; + std::string AUTORCC; + }; + +public: cmQtAutoGenGlobalInitializer( std::vector const& localGenerators); ~cmQtAutoGenGlobalInitializer(); + Keywords const* kw() const { return Keywords_.get(); }; + bool generate(); private: @@ -48,6 +62,7 @@ private: std::map GlobalAutoGenTargets_; std::map GlobalAutoRccTargets_; std::unordered_map ExecutableTestOutputs_; + std::unique_ptr Keywords_; }; #endif -- cgit v0.12