]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIOTreeHandlerImageAdder.cpp
correction of bugs
[creaImageIO.git] / src / creaImageIOTreeHandlerImageAdder.cpp
index 34be57a7478f08136c872d8654400f682e29bbe4..3e2ff04943f05a3f840164b9e12a8741ffc128e0 100644 (file)
@@ -138,19 +138,8 @@ namespace creaImageIO
                }
                else
                {
-                 std::string path=node->GetAttribute("FullFileName");
-                 //Gets the add key
-                 std::string addKey=mSynchronizer->GetAttribute("ADD_KEY","IGNORED_FILES","PATH",path,mCurrentDB);
-                 //Gets the number of files added
-                 int files=atoi((mSynchronizer->GetAttribute("FILES_ADDED","ADD_OPS","ADD_KEY",addKey,mCurrentDB)).c_str());
-                 files=files-1;
-                 std::stringstream out;
-                 out<<files;
-                 //Sets the new number of files
-                 mSynchronizer->SetAttribute("FILES_ADDED","ADD_OPS",out.str(),"ADD_KEY",addKey,mCurrentDB);
-                 //Sets the file as removed
-                 mSynchronizer->SetAttribute("REMOVE","IGNORED_FILES","1","PATH = '"+path+"' AND ADD_KEY",addKey,mCurrentDB);
-               }
+               remove(node);
+        }
   }
 
   //=====================================================================
@@ -167,7 +156,16 @@ namespace creaImageIO
                }
                else
                {
-                  std::string path=(*it)->GetAttribute("FullFileName");
+               remove(*it);
+               }
+       
+         }
+  }
+
+
+  void  TreeHandlerImageAdder::remove( tree::Node* i_node)
+  {
+         std::string path=i_node->GetAttribute("FullFileName");
                  //Gets the add key
                  std::string addKey=mSynchronizer->GetAttribute("ADD_KEY","IGNORED_FILES","PATH",path,mCurrentDB);
                  //Gets the number of files added
@@ -179,11 +177,7 @@ namespace creaImageIO
                  mSynchronizer->SetAttribute("FILES_ADDED","ADD_OPS",out.str(),"ADD_KEY",addKey,mCurrentDB);
                  //Sets the file as removed
                  mSynchronizer->SetAttribute("REMOVE","IGNORED_FILES","1","PATH = '"+path+"' AND ADD_KEY",addKey,mCurrentDB);
-               }
-       
-         }
   }
-
  
   
   //=======================================================================