]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMFolder.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / modelCDMFolder.cpp
index c97b129d005da0033615ff9221ed2040899788e5..ca83e0550eb114af6075c73e0e98d51631004350 100644 (file)
@@ -47,10 +47,11 @@ modelCDMFolder::modelCDMFolder()
   this->CMakeLists = NULL;
 }
 
-modelCDMFolder::modelCDMFolder(const std::string& path, const std::string& name, const int& level)
+modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level)
 {
   std::cout << "creating folder: " + path + "\n";
   //set attributes
+  this->parent = parent;
   this->children.clear();
   this->level = level;
   this->CMakeLists = NULL;
@@ -71,7 +72,7 @@ modelCDMFolder::modelCDMFolder(const std::string& path, const std::string& name,
           std::string stdfileName = crea::wx2std(fileName);
 
           //if is an unknown folder, create folder
-          modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+          modelCDMFolder* folder = new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
           this->children.push_back(folder);
           this->folders.push_back(folder);
 
@@ -86,12 +87,12 @@ modelCDMFolder::modelCDMFolder(const std::string& path, const std::string& name,
           //if CMakeLists, create CMakeLists
           if(stdfileName == "CMakeLists.txt")
             {
-              this->CMakeLists = new modelCDMCMakeListsFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
               this->children.push_back(this->CMakeLists);
             }
           else
             {
-              this->children.push_back(new modelCDMFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+              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);
@@ -125,8 +126,8 @@ bool modelCDMFolder::CreateClass(const std::string& name)
       }
     else
       {
-        this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1));
-        this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".cpp", name + ".cpp", this->level + 1));
+        this->children.push_back(new modelCDMFile(this, this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1));
+        this->children.push_back(new modelCDMFile(this, this->path + CDMUtilities::SLASH + name + ".cpp", name + ".cpp", this->level + 1));
         this->SortChildren();
         return true;
       }
@@ -141,7 +142,7 @@ modelCDMFolder* modelCDMFolder::CreateFolder(const std::string& name, std::strin
       result = new std::string("Error executing: " + command + ".");
       return NULL;
     }
-  modelCDMFolder* folder = new modelCDMFolder(path + CDMUtilities::SLASH + name, name, level + 1);
+  modelCDMFolder* folder = new modelCDMFolder(this, path + CDMUtilities::SLASH + name, name, level + 1);
   this->folders.push_back(folder);
   this->children.push_back(folder);
 
@@ -199,7 +200,7 @@ const bool modelCDMFolder::Refresh(std::string*& result)
             }
           if(!found)
             {
-              modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
               this->folders.push_back(folder);
               this->children.push_back(folder);
             }
@@ -216,7 +217,7 @@ const bool modelCDMFolder::Refresh(std::string*& result)
             {
               if (this->CMakeLists == NULL)
                 {
-                  this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                  this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
                   this->children.push_back(this->CMakeLists);
                 }
               else
@@ -245,7 +246,7 @@ const bool modelCDMFolder::Refresh(std::string*& result)
 
               if(!found)
                 {
-                  modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                  modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
                   this->children.push_back(file);
                 }
             }