2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
31 * Created on: Nov 23, 2012
32 * Author: Daniel Felipe Gonzalez Obando
35 #include "modelCDMPackage.h"
39 #include "CDMUtilities.h"
41 modelCDMPackage::modelCDMPackage()
45 modelCDMPackage::modelCDMPackage(const std::string& path, const int& level)
47 this->type = wxDIR_DIRS;
49 std::vector<std::string> words;
50 std::string delimiters;
51 //TODO::fix for windows
53 CDMUtilities::splitter::split(words, path, delimiters, CDMUtilities::splitter::no_empties);
54 this->name = words[words.size()-1].substr(5, words[words.size()-1].size()-9);
55 this->namePackage = this->name;
59 //check all folders and files
60 wxDir dir(crea::std2wx((path).c_str()));
66 bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS);
69 std::string stdfileName = crea::wx2std(fileName);
70 //if src, check for black boxes
71 if(stdfileName == "src")
73 wxDir srcF(crea::std2wx((path + delimiters + "src").c_str()));
77 bool innerCont = srcF.GetFirst(&srcName, wxT("*.h"), wxDIR_FILES);
80 if(crea::wx2std(srcName.substr(0,2)) == "bb")
82 modelCDMBlackBox* blackbox = new modelCDMBlackBox(crea::wx2std(srcName), path + delimiters + "src", this->level + 1);
83 this->blackBoxes.push_back(blackbox);
84 this->children.push_back(blackbox);
86 innerCont = srcF.GetNext(&srcName);
90 //if is an unknown folder, create folder
93 this->children.push_back(new modelCDMFolder(path + delimiters + stdfileName, this->level + 1));
95 cont = dir.GetNext(&fileName);
99 cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES);
102 std::string stdfileName = crea::wx2std(fileName);
104 //if CMakeLists, create CMakeLists
105 if(stdfileName == "CMakeLists.txt")
107 this->CMakeLists = new modelCDMCMakeListsFile(path + delimiters + stdfileName, this->level + 1);
108 this->children.push_back(this->CMakeLists);
112 this->children.push_back(new modelCDMFile(path + delimiters + stdfileName, this->level + 1));
114 //if is an unknown file, create file
115 cont = dir.GetNext(&fileName);
118 this->SortChildren();
121 modelCDMPackage::~modelCDMPackage()
125 const std::string& modelCDMPackage::GetNamePackage() const
127 return this->namePackage;
130 const std::string& modelCDMPackage::GetAuthors() const
132 return this->authors;
135 const std::string& modelCDMPackage::GetAuthorsEmail() const
137 return this->authorsEmail;
140 const std::string& modelCDMPackage::GetVersion() const
142 return this->version;
145 const std::string& modelCDMPackage::GetDescription() const
147 return this->description;
150 bool modelCDMPackage::SetAuthors(const std::string& authors, std::string*& result)
152 //TODO: implement method
156 bool modelCDMPackage::SetAuthorsEmail(const std::string& email, std::string*& result)
158 //TODO: implement method
162 bool modelCDMPackage::SetVersion(const std::string& version, std::string*& result)
164 //TODO: implement method
168 bool modelCDMPackage::SetDescription(const std::string& description, std::string*& result)
170 //TODO: implement method
174 bool modelCDMPackage::CreateBlackBox(
175 const std::string& name,
176 const std::string& authors,
177 const std::string& authorsEmail,
178 const std::string& categories,
179 const std::string& description
182 //TODO: implement method
186 bool modelCDMPackage::OpenCMakeListsFile(std::string*& result)
188 //TODO: implement method
192 const bool modelCDMPackage::Refresh(std::string*& result)
194 //TODO: implement method