/* # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image # pour la Sant�) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil # # This software is governed by the CeCILL-B license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL-B # license as circulated by CEA, CNRS and INRIA at the following URL # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # or in the file LICENSE.txt. # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ /* * modelCDMProject.cpp * * Created on: 13/11/2012 * Author: Daniel Felipe Gonzalez Obando */ #include "modelCDMProject.h" #include #include #include #include "CDMUtilities.h" #include "creaWx.h" #include "wx/dir.h" modelCDMProject::modelCDMProject() { std::cout << "in constructor1" << std::endl; this->appli = NULL; this->lib = NULL; } modelCDMProject::modelCDMProject( const std::string& path, const std::string& buildPath ) { this->path = CDMUtilities::fixPath(path); //open makelists file std::string pathFixed(CDMUtilities::fixPath(path)); //TODO: set pathMakeLists for windows std::string pathMakeLists = pathFixed + "/CMakeLists.txt"; std::ifstream confFile; confFile.open((pathMakeLists).c_str()); std::string word; while(confFile.is_open() && !confFile.eof()) { //std::cout << "leyendo " << word << std::endl; //get project name std::getline(confFile,word,'('); std::vector wordBits; CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); if(wordBits[wordBits.size()-1] == "PROJECT") { std::getline(confFile,word,')'); std::vector nameBits; CDMUtilities::splitter::split(nameBits, word, " ", CDMUtilities::splitter::no_empties); this->name = ""; for (int i = 0; i < nameBits.size(); i++) { if(i != 0) this->name += " "; this->name += nameBits[i]; } } if(wordBits[wordBits.size()-1] == "SET") { //get project version std::getline(confFile,word,')'); if(word.find("PROJECT_MAJOR_VERSION") != std::string::npos) { std::vector versionBits; CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties); version = versionBits[versionBits.size()-1]; } if(word.find("PROJECT_MINOR_VERSION") != std::string::npos) { std::vector versionBits; CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties); version += "." + versionBits[versionBits.size()-1]; } if(word.find("PROJECT_BUILD_VERSION") != std::string::npos) { std::vector versionBits; CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties); version += "." + versionBits[versionBits.size()-1]; } //get project versionDate if(word.find("PROJECT_VERSION_DATE") != std::string::npos) { std::vector versionBits; CDMUtilities::splitter::split(versionBits, word, " \"", CDMUtilities::splitter::no_empties); versionDate = versionBits[versionBits.size()-1]; } //get project buildPath if (buildPath != "") { this->buildPath = buildPath; } else { this->buildPath = this->path + "Bin"; } } } confFile.close(); this->type = wxDIR_DIRS; this->level = 0; //TODO: implement method //if appli exist create Appli this->appli = NULL; //if lib exist create Lib this->lib = NULL; //if bbtk_* exist create Packages } modelCDMProject::~modelCDMProject() { if(this->appli != NULL) { delete this->appli; this->appli = NULL; } if(this->lib != NULL) { delete this->lib; this->lib = NULL; } for (int i = 0; i < this->packages.size(); i++) { if(this->packages[i] != NULL) { delete this->packages[i]; this->packages[i] = NULL; } } } const std::string& modelCDMProject::GetName() const { return this->name; } const std::string& modelCDMProject::GetVersion() const { return this->version; } const std::string& modelCDMProject::GetVersionDate() const { return this->versionDate; } const std::string& modelCDMProject::GetBuildPath() const { return this->buildPath; } bool modelCDMProject::SetVersion(const std::string& version, std::string*& result) { //TODO: implement method return true; } bool modelCDMProject::SetBuildPath(const std::string& path, std::string*& result) { //TODO: implement method return true; } bool modelCDMProject::CreatePackage( const std::string& name, std::string*& result, const std::string& authors, const std::string& authorsEmail, const std::string& version, const std::string& description ) { //TODO: implement method return true; } bool modelCDMProject::CreateLibrary( const std::string& name, std::string*& result, const std::string& path ) { //TODO: implement method return true; } bool modelCDMProject::CreateApplication( const std::string& name, std::string*& result, const std::string& path ) { //TODO: implement method return true; } bool modelCDMProject::CreateBlackBox( const std::string& name, const std::string& package, const std::string& authors, const std::string& authorsEmail, const std::string& categories, const std::string& description ) { //TODO: implement method return true; } bool modelCDMProject::OpenCMakeListsFile(std::string*& result) { //TODO: implement method return true; } const bool modelCDMProject::Refresh(std::string*& result) { //TODO: implement method return true; } bool modelCDMProject::ConfigureBuild(std::string*& result) { //TODO: implement method return true; } bool modelCDMProject::Build(std::string*& result) { //TODO: implement method return true; } bool modelCDMProject::Connect(std::string*& result) { //TODO: implement method return true; }