Pārlūkot izejas kodu

AUTOGEN: Generators: Moc/UicSkipTest methods

Sebastian Holtermann 8 gadi atpakaļ
vecāks
revīzija
d58b6bf31c
2 mainītis faili ar 38 papildinājumiem un 28 dzēšanām
  1. 35 28
      Source/cmQtAutoGenerators.cxx
  2. 3 0
      Source/cmQtAutoGenerators.h

+ 35 - 28
Source/cmQtAutoGenerators.cxx

@@ -610,16 +610,7 @@ void cmQtAutoGenerators::ParseContentForUic(
   const std::string& absFilename, const std::string& contentsString,
   std::map<std::string, std::vector<std::string> >& includedUis)
 {
-  if (this->UicExecutable.empty()) {
-    return;
-  }
-  // Check skip list
-  if (ListContains(this->SkipUic, absFilename)) {
-    if (this->Verbose) {
-      std::ostringstream err;
-      err << "AUTOUIC: Skipping " << absFilename << "\n";
-      this->LogInfo(err.str());
-    }
+  if (this->UicExecutable.empty() || this->UicSkipTest(absFilename)) {
     return;
   }
 
@@ -653,16 +644,7 @@ bool cmQtAutoGenerators::ParseContentForMoc(
   const std::vector<std::string>& headerExtensions,
   std::map<std::string, std::string>& includedMocs, bool relaxed)
 {
-  if (this->MocExecutable.empty()) {
-    return true;
-  }
-  // Check skip list
-  if (ListContains(this->SkipMoc, absFilename)) {
-    if (this->Verbose) {
-      std::ostringstream err;
-      err << "AUTOMOC: Skipping " << absFilename << "\n";
-      this->LogInfo(err.str());
-    }
+  if (this->MocExecutable.empty() || this->MocSkipTest(absFilename)) {
     return true;
   }
 
@@ -921,14 +903,7 @@ void cmQtAutoGenerators::ParseHeaders(
     if (!this->MocExecutable.empty() &&
         (absHeadersMoc.find(headerName) != absHeadersMoc.end()) &&
         (includedMocs.find(headerName) == includedMocs.end())) {
-      if (ListContains(this->SkipMoc, headerName)) {
-        // Skip
-        if (this->Verbose) {
-          std::ostringstream err;
-          err << "AUTOMOC: Skipping " << headerName << "\n";
-          this->LogInfo(err.str());
-        }
-      } else {
+      if (!this->MocSkipTest(headerName)) {
         // Process
         if (this->Verbose) {
           std::ostringstream err;
@@ -1396,6 +1371,38 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
   return false;
 }
 
+/**
+ * @brief Tests if the file name is in the skip list
+ */
+bool cmQtAutoGenerators::MocSkipTest(const std::string& absFilename)
+{
+  if (ListContains(this->SkipMoc, absFilename)) {
+    if (this->Verbose) {
+      std::ostringstream msg;
+      msg << "AUTOMOC: Skipping " << absFilename << "\n";
+      this->LogInfo(msg.str());
+    }
+    return true;
+  }
+  return false;
+}
+
+/**
+ * @brief Tests if the file name is in the skip list
+ */
+bool cmQtAutoGenerators::UicSkipTest(const std::string& absFilename)
+{
+  if (ListContains(this->SkipUic, absFilename)) {
+    if (this->Verbose) {
+      std::ostringstream msg;
+      msg << "AUTOUIC: Skipping " << absFilename << "\n";
+      this->LogInfo(msg.str());
+    }
+    return true;
+  }
+  return false;
+}
+
 /**
  * @brief Collects name collisions as output/input pairs
  * @return True if there were collisions

+ 3 - 0
Source/cmQtAutoGenerators.h

@@ -86,6 +86,9 @@ private:
 
   void Init();
 
+  bool MocSkipTest(const std::string& absFilename);
+  bool UicSkipTest(const std::string& absFilename);
+
   bool NameCollisionTest(const std::map<std::string, std::string>& genFiles,
                          std::multimap<std::string, std::string>& collisions);