]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMProject.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / modelCDMProject.cpp
index dff1b63728b2fe054d5514cd4d4e9d430b717a06..7d0b454eda24c40272a78d8ef410d77dfac711aa 100644 (file)
@@ -189,6 +189,8 @@ modelCDMProject::modelCDMProject(
       while (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
+          std::size_t fileTypePos = stdfileName.find_last_of(".");
+          std::string fileType = stdfileName.substr(fileTypePos);
 
           //if CMakeLists, create CMakeLists
           if(stdfileName == "CMakeLists.txt")
@@ -196,11 +198,23 @@ modelCDMProject::modelCDMProject(
               this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
               this->children.push_back(this->CMakeLists);
             }
+          //if is a code file, create modelCDMCodeFile
+          else if(
+              fileType == ".c" ||
+              fileType == ".cxx" ||
+              fileType == ".h" ||
+              fileType == ".cpp" ||
+              fileType == ".txx" ||
+              fileType == ".cmake" )
+            {
+              this->children.push_back(new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+            }
+          //if is an unknown file, create file
           else
             {
               this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
             }
-          //if is an unknown file, create file
+
           cont = dir.GetNext(&fileName);
         }
     }
@@ -629,6 +643,8 @@ const bool modelCDMProject::Refresh(std::string*& result)
       while (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
+          std::size_t fileTypePos = stdfileName.find_last_of(".");
+          std::string fileType = stdfileName.substr(fileTypePos);
 
           //if CMakeLists, create CMakeLists
           if(stdfileName == "CMakeLists.txt")
@@ -646,6 +662,7 @@ const bool modelCDMProject::Refresh(std::string*& result)
                     return false;
                 }
             }
+          //if is a code file, create modelCDMCodeFile
           //if is an unknown file, create file
           else
             {
@@ -663,8 +680,21 @@ const bool modelCDMProject::Refresh(std::string*& result)
 
               if(!found)
                 {
-                  modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
-                  this->children.push_back(file);
+                  if(
+                    fileType == ".c" ||
+                    fileType == ".cxx" ||
+                    fileType == ".h" ||
+                    fileType == ".cpp" ||
+                    fileType == ".txx" ||
+                    fileType == ".cmake" )
+                    {
+                      this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+                    }
+                  else
+                    {
+                      modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                      this->children.push_back(file);
+                    }
                 }
             }
 
@@ -1138,7 +1168,7 @@ std::map<std::string, bool> modelCDMProject::Get3rdPartyLibraries()
       boost::match_flag_type flags = boost::match_default;
       while(boost::regex_search(start, end, what, expression, flags))
         {
-          std::cout << what[0].str() << std::endl;
+          //std::cout << what[0].str() << std::endl;
           boost::regex expression1 = boost::regex("USE_\\w+");
           std::string::const_iterator start1, end1;
           start1 = what[0].first;
@@ -1148,7 +1178,7 @@ std::map<std::string, bool> modelCDMProject::Get3rdPartyLibraries()
             {
               std::string dete = what1.str();
               CDMUtilities::normalizeStr(dete);
-              std::cout << dete << std::endl;
+              //std::cout << dete << std::endl;
               if(correspondence.find(dete) != correspondence.end())
                 res[correspondence[dete]] = true;
             }