diff options
Diffstat (limited to 'Source/cmQtAutoMocUic.cxx')
-rw-r--r-- | Source/cmQtAutoMocUic.cxx | 70 |
1 files changed, 31 insertions, 39 deletions
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 3556051..68d3c6c 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -55,7 +55,6 @@ public: cmQtAutoMocUicT(cmQtAutoMocUicT const&) = delete; cmQtAutoMocUicT& operator=(cmQtAutoMocUicT const&) = delete; -public: // -- Types /** Include string with sub parts. */ @@ -112,7 +111,6 @@ public: using FileHandleT = std::shared_ptr<FileT>; using GetOrInsertT = std::pair<FileHandleT, bool>; - public: ParseCacheT(); ~ParseCacheT(); @@ -135,7 +133,6 @@ public: { } - public: std::string FileName; cmFileTime FileTime; ParseCacheT::FileHandleT ParseData; @@ -266,7 +263,6 @@ public: std::vector<std::string> Options; }; - public: UicSettingsT(); ~UicSettingsT(); @@ -379,7 +375,6 @@ public: void MocIncludes(); void UicIncludes(); - protected: SourceFileHandleT FileHandle; std::string Content; }; @@ -572,7 +567,6 @@ private: static std::vector<std::string> dependenciesFromDepFile( const char* filePath); -private: // -- Settings BaseSettingsT BaseConst_; BaseEvalT BaseEval_; @@ -1432,13 +1426,12 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::FindIncludedHeader( return true; } // Search in include directories - for (std::string const& path : this->MocConst().IncludePaths) { - if (findHeader(cmStrCat(path, '/', includeBase))) { - return true; - } - } - // Return without success - return false; + auto const& includePaths = this->MocConst().IncludePaths; + return std::any_of( + includePaths.begin(), includePaths.end(), + [&findHeader, &includeBase](std::string const& path) -> bool { + return findHeader(cmStrCat(path, '/', includeBase)); + }); } bool cmQtAutoMocUicT::JobEvalCacheMocT::RegisterIncluded( @@ -1544,31 +1537,30 @@ bool cmQtAutoMocUicT::JobEvalCacheUicT::EvalFile( } std::string const sourceDirPrefix = SubDirPrefix(sourceFile.FileName); - for (IncludeKeyT const& incKey : Include) { - // Find .ui file - this->UiName = cmStrCat(incKey.Base, ".ui"); - if (!this->FindIncludedUi(sourceDirPrefix, incKey.Dir)) { - this->LogError( - GenT::UIC, - cmStrCat(this->MessagePath(sourceFile.FileName), - "\nincludes the uic file ", this->MessagePath(incKey.Key), - ",\nbut the user interface file ", - this->MessagePath(this->UiName), - "\ncould not be found in the following directories\n", - this->MessageSearchLocations())); - return false; - } - // Check if the file is skipped - if (this->UicConst().skipped(this->UiFileHandle->FileName)) { - continue; - } - // Register mapping - if (!this->RegisterMapping(incKey.Key, sourceFileHandle)) { - return false; - } - } - - return true; + return std::all_of( + Include.begin(), Include.end(), + [this, &sourceDirPrefix, &sourceFile, + &sourceFileHandle](IncludeKeyT const& incKey) -> bool { + // Find .ui file + this->UiName = cmStrCat(incKey.Base, ".ui"); + if (!this->FindIncludedUi(sourceDirPrefix, incKey.Dir)) { + this->LogError( + GenT::UIC, + cmStrCat(this->MessagePath(sourceFile.FileName), + "\nincludes the uic file ", this->MessagePath(incKey.Key), + ",\nbut the user interface file ", + this->MessagePath(this->UiName), + "\ncould not be found in the following directories\n", + this->MessageSearchLocations())); + return false; + } + // Check if the file is skipped + if (this->UicConst().skipped(this->UiFileHandle->FileName)) { + return true; + } + // Register mapping + return this->RegisterMapping(incKey.Key, sourceFileHandle); + }); } bool cmQtAutoMocUicT::JobEvalCacheUicT::FindIncludedUi( @@ -2708,7 +2700,7 @@ void cmQtAutoMocUicT::CreateParseJobs(SourceFileMapT const& sourceMap) { cmFileTime const parseCacheTime = this->BaseEval().ParseCacheTime; ParseCacheT& parseCache = this->BaseEval().ParseCache; - for (auto& src : sourceMap) { + for (const auto& src : sourceMap) { // Get or create the file parse data reference ParseCacheT::GetOrInsertT cacheEntry = parseCache.GetOrInsert(src.first); src.second->ParseData = std::move(cacheEntry.first); |