X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMLib.cpp;h=994ae85a2684a9bc850c10a73a36fff7dfcc07cf;hb=dd9de710df141a074f10d0cab27b217425ecab20;hp=3dcf9b8786766ce64d0681718d4dc22f16a65f6b;hpb=e5da2a095f1be871a0489b38a060f9bfb4beb598;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index 3dcf9b8..994ae85 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -91,6 +91,8 @@ modelCDMLib::modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& pa while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -98,6 +100,17 @@ modelCDMLib::modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& pa this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } + //if is a code file, create modelCDMCodeFile + else if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } //if is an unknown file, create file else { @@ -268,6 +281,9 @@ const bool modelCDMLib::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); + std::size_t fileTypePos = stdfileName.find_last_of("."); + std::string fileType = stdfileName.substr(fileTypePos); + //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") @@ -302,8 +318,22 @@ const bool modelCDMLib::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->children.push_back(file); + //if is a code file, create modelCDMCodeFile + if( + fileType == ".c" || + fileType == ".cxx" || + fileType == ".h" || + fileType == ".cpp" || + fileType == ".txx" || + fileType == ".cmake" ) + { + this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } } }