X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src2%2FcreaImageIOSynchron.cpp;h=06785fe8e94bc32d55335409f95fea662b040920;hb=5970066f11bb2288cc7dc9fe173051c2a343789d;hp=3bd73e433107d16cfbcf2fb4be9d0375e25ab60f;hpb=48959b03ebd4e0d100f468f6c05c873f70b43516;p=creaImageIO.git diff --git a/src2/creaImageIOSynchron.cpp b/src2/creaImageIOSynchron.cpp index 3bd73e4..06785fe 100644 --- a/src2/creaImageIOSynchron.cpp +++ b/src2/creaImageIOSynchron.cpp @@ -1,8 +1,9 @@ #include #include #include +#include +//namespace fs = boost::filesystem; -namespace fs = boost::filesystem; //===================================================================== @@ -52,7 +53,7 @@ namespace creaImageIO //===================================================================== void Synchronizer::Initialize() { - if (!fs::exists(pathDB)) + if (!boost::filesystem::exists(pathDB)) { CreateDB(); } @@ -146,7 +147,7 @@ namespace creaImageIO ///////////////////////////////////////////////////////////////////////////////////////////////// // remove an entry of the DB - //@param i_table : table where do the remove + //@param i_table : table where to do the remove // @param i_key : the add_key reference (one entry to remove for ADD_OP table, many for IGNORED_FILES table //@result : - ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -156,6 +157,24 @@ namespace creaImageIO UPDATESYNCDB(query); } + ///////////////////////////////////////////////////////////////////////////////////////////////// + // remove several entries of the DB + // @param i_table : table where to do the remove + // @param i_attribute: attribute to match + // @param i_operand : operand to use + // @param i_val : the reference + //@result : - + ///////////////////////////////////////////////////////////////////////////////////////////////// + void Synchronizer::RemoveEntries(const std::string i_table, + const std::string i_attribute, + const std::string i_operand, + const std::string i_val) + { + std::stringstream query; + query<<"DELETE FROM "< i_names; + std::string query = "SELECT PATH, REMOVE FROM IGNORED_FILES"; + CppSQLite3Query res; + QUERYSYNCDB(query, res); + while (!res.eof()) + { + std::string file(res.getStringField(0)); + std::string ignore(res.getStringField(1)); + mList[file] = ignore == "0"? true : false; + res.nextRow(); + } + + } + + bool Synchronizer::isIndexed(const std::string filename) + { + bool valid = true; + std::string name(filename); + boost::algorithm::replace_all( name,"\\" , "/"); + std::map ::iterator it_list = mList.begin(); + for(;it_list != mList.end(); it_list++) + { + if(it_list->first == name) + { + valid = false; + break; + } + } + return valid; + } +} \ No newline at end of file