X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FcreaDevManagerLib%2FmodelCDMBlackBox.cpp;h=73220cc924cc93d7bc416bf848e25384c0670073;hb=5a17d994576296f2a5a85f3a01ad5631786a0c56;hp=4d834927d61e08d6e3609d4b889ec595e5c732fe;hpb=cfa883d25e73975f73c20fefc1ec2c947d827938;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMBlackBox.cpp b/lib/creaDevManagerLib/modelCDMBlackBox.cpp index 4d83492..73220cc 100644 --- a/lib/creaDevManagerLib/modelCDMBlackBox.cpp +++ b/lib/creaDevManagerLib/modelCDMBlackBox.cpp @@ -47,8 +47,10 @@ modelCDMBlackBox::modelCDMBlackBox() this->header = NULL; } -modelCDMBlackBox::modelCDMBlackBox(const std::string& path, const std::string& name, const int& level) +modelCDMBlackBox::modelCDMBlackBox(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { + std::cout << "creating black box: " + name + " in " + path + "\n"; + this->parent = parent; this->name = name; this->path = path; this->level = level; @@ -130,7 +132,7 @@ bool modelCDMBlackBox::SetAuthors(const std::string& authors, std::string*& resu std::vector words; CDMUtilities::splitter::split(words, authors, "/\\\"\n", CDMUtilities::splitter::no_empties); std::string authorsReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { authorsReal += "," + words[i]; } @@ -170,7 +172,12 @@ bool modelCDMBlackBox::SetAuthors(const std::string& authors, std::string*& resu in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -190,7 +197,7 @@ bool modelCDMBlackBox::SetCategories( std::vector words; CDMUtilities::splitter::split(words, categories, "\"\\/", CDMUtilities::splitter::no_empties); std::string catsReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { catsReal += "," + words[i]; } @@ -230,7 +237,12 @@ bool modelCDMBlackBox::SetCategories( in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -249,7 +261,7 @@ bool modelCDMBlackBox::SetDescription( std::vector words; CDMUtilities::splitter::split(words, description, "\"\n\\/", CDMUtilities::splitter::no_empties); std::string descReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { descReal += "-" + words[i]; } @@ -289,7 +301,11 @@ bool modelCDMBlackBox::SetDescription( in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -332,6 +348,7 @@ modelCDMFile* modelCDMBlackBox::GetSourceFile() const const bool modelCDMBlackBox::Refresh(std::string*& result) { + std::cout << "refreshing black box: " << this->nameBlackBox << std::endl; std::string pathHeader = path + CDMUtilities::SLASH + "bb" + this->name + ".h"; std::ifstream confFile;