X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=inline;f=src2%2FcreaImageIOSynchron.cpp;h=06785fe8e94bc32d55335409f95fea662b040920;hb=66b7c66deb6102bd632daf96fe298b1d5764b7cc;hp=74e9e98ced8fc532e9c0843a593098db249dce02;hpb=595926ac27740a8822b6de9579e2e148c59f469c;p=creaImageIO.git diff --git a/src2/creaImageIOSynchron.cpp b/src2/creaImageIOSynchron.cpp index 74e9e98..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(); } @@ -377,5 +378,45 @@ namespace creaImageIO sql += "';"; UPDATESYNCDB(sql); } -} + + +///////////////////////////////////////////////////////////////////////////////////////////////// + // get the files name to ignore for a add operation synchronization + // @param : the add key + //@result : list (path) of ignore files + ///////////////////////////////////////////////////////////////////////////////////////////////// + void Synchronizer::GetList() + { + mList.clear(); + std::vector 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