this->CMakeLists = NULL;
}
-modelCDMFolder::modelCDMFolder(const std::string& path, const std::string& name, const int& level)
+modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level)
{
std::cout << "creating folder: " + path + "\n";
//set attributes
+ this->parent = parent;
this->children.clear();
this->level = level;
this->CMakeLists = NULL;
std::string stdfileName = crea::wx2std(fileName);
//if is an unknown folder, create folder
- modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ modelCDMFolder* folder = new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
this->children.push_back(folder);
this->folders.push_back(folder);
while (cont)
{
std::string stdfileName = crea::wx2std(fileName);
+ std::cout << "analyzing " << stdfileName << std::endl;
+ std::size_t fileTypePos = stdfileName.find_last_of(".");
+ std::string fileType;
+ if(fileTypePos != std::string::npos)
+ fileType = stdfileName.substr(fileTypePos);
+ else
+ fileType = "";
+ std::cout << "fileType: " << fileType <<std::endl;
//if CMakeLists, create CMakeLists
if(stdfileName == "CMakeLists.txt")
{
- this->CMakeLists = new modelCDMCMakeListsFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
this->children.push_back(this->CMakeLists);
}
- else
+ //if is a code file, create code file
+ else if(fileType == ".c" ||
+ fileType == ".cxx" ||
+ fileType == ".h" ||
+ fileType == ".cpp" ||
+ fileType == ".txx" ||
+ fileType == ".cmake" )
+ {
+ modelCDMCodeFile* file = new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(file);
+ }
+ //if is a bbs file, create bbs file
+ else if(fileType == ".bbs")
+ {
+ modelCDMBBSFile* file = new modelCDMBBSFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(file);
+ }
+ //if is a bbg file, create bbg file
+ else if(fileType == ".bbg")
{
- this->children.push_back(new modelCDMFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+ modelCDMBBGFile* file = new modelCDMBBGFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(file);
}
//if is an unknown file, create file
+ else
+ {
+ this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+ }
+
cont = dir.GetNext(&fileName);
}
}
{
this->folders.clear();
this->CMakeLists = NULL;
- for (int i = 0; i < this->children.size(); i++)
+ for (int i = 0; i < (int)(this->children.size()); i++)
{
if(this->children[i] != NULL)
{
}
else
{
- this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1));
- this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".cpp", name + ".cpp", this->level + 1));
+ this->children.push_back(new modelCDMFile(this, this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1));
+ this->children.push_back(new modelCDMFile(this, this->path + CDMUtilities::SLASH + name + ".cpp", name + ".cpp", this->level + 1));
this->SortChildren();
return true;
}
result = new std::string("Error executing: " + command + ".");
return NULL;
}
- modelCDMFolder* folder = new modelCDMFolder(path + CDMUtilities::SLASH + name, name, level + 1);
+ modelCDMFolder* folder = new modelCDMFolder(this, path + CDMUtilities::SLASH + name, name, level + 1);
this->folders.push_back(folder);
this->children.push_back(folder);
std::string stdfileName = crea::wx2std(fileName);
//check if they already exist
bool found = false;
- for (int i = 0; !found && i < this->folders.size(); i++)
+ for (int i = 0; !found && i < (int)(this->folders.size()); i++)
{
if (this->folders[i]->GetName() == stdfileName)
{
}
if(!found)
{
- modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
this->folders.push_back(folder);
this->children.push_back(folder);
}
while (cont)
{
std::string stdfileName = crea::wx2std(fileName);
+ std::size_t fileTypePos = stdfileName.find_last_of(".");
+ std::string fileType;
+ if(fileTypePos != std::string::npos)
+ fileType = stdfileName.substr(fileTypePos);
+ else
+ fileType = "";
//if CMakeLists, create CMakeLists
if(stdfileName == "CMakeLists.txt")
{
if (this->CMakeLists == NULL)
{
- this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
this->children.push_back(this->CMakeLists);
}
else
else
{
bool found = false;
- for (int i = 0;!found && i < this->children.size(); i++)
+ for (int i = 0;!found && i < (int)(this->children.size()); i++)
{
if (this->children[i]->GetName() == stdfileName)
{
if(!found)
{
- modelCDMFile* file = new modelCDMFile(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));
+ }
+ //if is a bbs file, create modelCDMBBSFile
+ else if(fileType == ".bbs")
+ {
+ this->children.push_back(new modelCDMBBSFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+ }
+ //if is a bbg file, create modelCDMBBGFile
+ else if(fileType == ".bbg")
+ {
+ this->children.push_back(new modelCDMBBGFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+ }
+ //if is an unknown file, create modelCDMFile
+ else
+ {
+ modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(file);
+ }
}
}
}
}
- for (int i = 0; i < checkedFolders.size(); i++)
+ for (int i = 0; i < (int)(checkedFolders.size()); i++)
{
if(!checkedFolders[i])
{
i--;
}
}
- for (int i = 0; i < checked.size(); i++)
+ for (int i = 0; i < (int)(checked.size()); i++)
{
if(!checked[i])
{