]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/ModelCreaDevManagerTree.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / ModelCreaDevManagerTree.cpp
index e4bcc71a6035cfc914e5edcb3eef72cf4531d667..4ae0ee2885920e0bb3d4975c435f7d014fa7dd40 100644 (file)
@@ -17,8 +17,6 @@
 #include <string>
 #include <cstring>
 
-using namespace std;
-
 ModelCreaDevManagerTree::ModelCreaDevManagerTree()
 {
 }
@@ -32,8 +30,8 @@ bool ModelCreaDevManagerTree::CompareNodeItem(ModelCreaDevManagerTreeNode x, Mod
   bool returnValue;
   bool noWinner = true;
   unsigned int i = 0;
-  string xName = x.GetName();
-  string yName = y.GetName();
+  std::string xName = x.GetName();
+  std::string yName = y.GetName();
   unsigned char xType = x.GetType();
   unsigned char yType = y.GetType();
 
@@ -73,11 +71,11 @@ bool ModelCreaDevManagerTree::CompareNodeItem(ModelCreaDevManagerTreeNode x, Mod
   return returnValue;
 }
 
-void ModelCreaDevManagerTree::addRoot(string path)
+void ModelCreaDevManagerTree::addRoot(std::string path)
 {
-  stringstream p(path);
-  vector<string> breadcrumbs;
-  string name;
+  std::stringstream p(path);
+  std::vector<std::string> breadcrumbs;
+  std::string name;
 
   while(!p.eof())
   {
@@ -94,25 +92,25 @@ void ModelCreaDevManagerTree::addRoot(string path)
   name = breadcrumbs[breadcrumbs.size()-1];
   this->projectRoots.push_back(ModelCreaDevManagerTreeNode(path,name,DT_DIR,0));
 
-  cout << "project root added: " << name << " in " << path << endl;
+  std::cout << "project root added: " << name << " in " << path << std::endl;
 }
 
 void ModelCreaDevManagerTree::populateNode(ModelCreaDevManagerTreeNode& node)
 {
-  //cout << "populating " << node.GetName() << " path " << node.GetPath() << "..." << endl;
-  vector <ModelCreaDevManagerTreeNode>*  nodes = new vector <ModelCreaDevManagerTreeNode>;
+  //std::cout << "populating " << node.GetName() << " path " << node.GetPath() << "..." << std::endl;
+  std::vector <ModelCreaDevManagerTreeNode>*  nodes = new std::vector <ModelCreaDevManagerTreeNode>;
 
   DIR *dp;
   struct dirent *ep;
 
-  string path = node.GetPath()+node.GetName()+"/";
+  std::string path = node.GetPath()+node.GetName()+"/";
 
   dp = opendir(path.c_str());
   if (dp != NULL)
   {
     while ((ep = readdir (dp)) != NULL)
     {
-      //cout << ep->d_name << endl;
+      //std::cout << ep->d_name << std::endl;
       if(strcmp(ep->d_name, ".") != 0 && strcmp(ep->d_name, "..") != 0 )
       {
         ModelCreaDevManagerTreeNode innerNode = ModelCreaDevManagerTreeNode(path, ep->d_name, ep->d_type, node.GetLevel()+1);
@@ -134,21 +132,21 @@ void ModelCreaDevManagerTree::populateNode(ModelCreaDevManagerTreeNode& node)
   }
   else
   {
-    cerr << "Couldn't open the directory" << endl;
+    std::cerr << "Couldn't open the directory" << std::endl;
   }
 }
 
-void ModelCreaDevManagerTree::populateNode(string path)
+void ModelCreaDevManagerTree::populateNode(std::string path)
 {
   if(path[path.size()-1] != '/')
     path+="/";
-  cout << "searching " << path << endl;
+  std::cout << "searching " << path << std::endl;
   for (int i = 0; i < this->projectRoots.size(); i++)
   {
-    //cout << (this->projectRoots[i].GetPath() + this->projectRoots[i].GetName() + "/") << "..." << endl;
+    //std::cout << (this->projectRoots[i].GetPath() + this->projectRoots[i].GetName() + "/") << "..." << std::endl;
     if(this->projectRoots[i].GetPath()+this->projectRoots[i].GetName()+"/" == path)
     {
-      cout << "Populating Project: " << path << "..." << endl;
+        std::cout << "Populating Project: " << path << "..." << std::endl;
       this->populateNode(this->projectRoots[i]);
       break;
     }