+ void TreeHandlerImageAdder::RemoveFile( const tree::Node*& node)
+ {
+ int n=node->GetNumberOfChildren();
+ if(n>0)
+ {
+ RemoveFiles(node->GetChildrenList());
+ }
+ else
+ {
+ std::string path=node->GetAttribute("FullFileName");
+ //Gets the add key
+ std::string addKey=mSynchronizer->GetAttribute("ADD_KEY","IGNORED_FILES","PATH",path);
+ //Gets the number of files added
+ int files=atoi((mSynchronizer->GetAttribute("FILES_ADDED","ADD_OPS","ADD_KEY",addKey)).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);
+ //Sets the file as removed
+ mSynchronizer->SetAttribute("REMOVE","IGNORED_FILES","1","PATH",path);
+ }
+ }
+
+ //=====================================================================
+
+ void TreeHandlerImageAdder::RemoveFiles(const std::vector<tree::Node*>& nodes)
+ {
+ std::vector<tree::Node*>::const_iterator it;
+ for(it=nodes.begin();it!=nodes.end();++it)
+ {
+ int n=(*it)->GetNumberOfChildren();
+ if(n>0)
+ {
+ RemoveFiles((*it)->GetChildrenList());
+ }
+ else
+ {
+ std::string path=(*it)->GetAttribute("FullFileName");
+ //Gets the add key
+ std::string addKey=mSynchronizer->GetAttribute("ADD_KEY","IGNORED_FILES","PATH",path);
+ //Gets the number of files added
+ int files=atoi((mSynchronizer->GetAttribute("FILES_ADDED","ADD_OPS","ADD_KEY",addKey)).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);
+ //Sets the file as removed
+ mSynchronizer->SetAttribute("REMOVE","IGNORED_FILES","1","PATH",path);
+ }
+
+ }
+ }
+