diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-08-31 09:47:58 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-09-07 15:53:19 (GMT) |
commit | 84658539bca3d0d45873872007b01a45712ba621 (patch) | |
tree | 78b13e8946080224790f32b2736e01f231f84530 /Source/cmQtAutoGenerators.cxx | |
parent | d8d064abbc10239cf61655da31d3e6a4a46298e7 (diff) | |
download | CMake-84658539bca3d0d45873872007b01a45712ba621.zip CMake-84658539bca3d0d45873872007b01a45712ba621.tar.gz CMake-84658539bca3d0d45873872007b01a45712ba621.tar.bz2 |
Autogen: Use single KeyRegExp filter struct
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 4e3ec96..7774a00 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -224,10 +224,10 @@ cmQtAutoGenerators::cmQtAutoGenerators() } // Moc macro filters - this->MocMacroFilters.push_back( - MocMacroFilter("Q_OBJECT", "[\n][ \t]*{?[ \t]*Q_OBJECT[^a-zA-Z0-9_]")); - this->MocMacroFilters.push_back( - MocMacroFilter("Q_GADGET", "[\n][ \t]*{?[ \t]*Q_GADGET[^a-zA-Z0-9_]")); + this->MocMacroFilters.emplace_back( + "Q_OBJECT", "[\n][ \t]*{?[ \t]*Q_OBJECT[^a-zA-Z0-9_]"); + this->MocMacroFilters.emplace_back( + "Q_GADGET", "[\n][ \t]*{?[ \t]*Q_GADGET[^a-zA-Z0-9_]"); // Precompile regular expressions this->MocRegExpInclude.compile( @@ -275,15 +275,15 @@ bool cmQtAutoGenerators::MocDependFilterPush(const std::string& key, bool success = false; if (!key.empty()) { if (!regExp.empty()) { - MocDependFilter filter; - filter.key = key; - if (filter.regExp.compile(regExp)) { - this->MocDependFilters.push_back(filter); + KeyRegExp filter; + filter.Key = key; + if (filter.RegExp.compile(regExp)) { + this->MocDependFilters.push_back(std::move(filter)); success = true; } else { this->LogError("AutoMoc: Error in AUTOMOC_DEPEND_FILTERS: Compiling " - "regular expression failed.\nKey: " + - Quoted(key) + "\nExp.: " + Quoted(regExp)); + "regular expression failed.\n Key: " + + Quoted(key) + "\n RegExp.: " + Quoted(regExp)); } } else { this->LogError("AutoMoc: Error in AUTOMOC_DEPEND_FILTERS: Regular " @@ -739,14 +739,14 @@ bool cmQtAutoGenerators::RunAutogen() bool cmQtAutoGenerators::MocRequired(const std::string& contentText, std::string* macroName) { - for (MocMacroFilter& filter : this->MocMacroFilters) { + for (KeyRegExp& filter : this->MocMacroFilters) { // Run a simple find string operation before the expensive // regular expression check - if (contentText.find(filter.first) != std::string::npos) { - if (filter.second.find(contentText)) { + if (contentText.find(filter.Key) != std::string::npos) { + if (filter.RegExp.find(contentText)) { // Return macro name on demand if (macroName != nullptr) { - *macroName = filter.first; + *macroName = filter.Key; } return true; } @@ -759,16 +759,16 @@ void cmQtAutoGenerators::MocFindDepends( const std::string& absFilename, const std::string& contentText, std::map<std::string, std::set<std::string>>& mocDepends) { - for (MocDependFilter& filter : this->MocDependFilters) { + for (KeyRegExp& filter : this->MocDependFilters) { // Run a simple find string operation before the expensive // regular expression check - if (contentText.find(filter.key) != std::string::npos) { + if (contentText.find(filter.Key) != std::string::npos) { // Run regular expression check loop const std::string sourcePath = SubDirPrefix(absFilename); const char* contentChars = contentText.c_str(); - while (filter.regExp.find(contentChars)) { + while (filter.RegExp.find(contentChars)) { // Evaluate match - const std::string match = filter.regExp.match(1); + const std::string match = filter.RegExp.match(1); if (!match.empty()) { // Find the dependency file std::string incFile; @@ -784,7 +784,7 @@ void cmQtAutoGenerators::MocFindDepends( Quoted(match)); } } - contentChars += filter.regExp.end(); + contentChars += filter.RegExp.end(); } } } |