X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMIProjectTreeNode.cpp;h=8b076580636b29a0a9a715c5e7b0e9ae0b2639c5;hb=dd9de710df141a074f10d0cab27b217425ecab20;hp=8676627df6bf2717ab480dcf90e5244461a10772;hpb=d8222afd6508f39bd37426842667de2e431cca4a;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp index 8676627..8b07658 100644 --- a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp @@ -23,7 +23,7 @@ # 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. # ------------------------------------------------------------------------ -*/ + */ /* * modelCDMIProjectTreeNode.cpp @@ -49,42 +49,42 @@ bool modelCDMIProjectTreeNode::CompareNodeItem(const modelCDMIProjectTreeNode* x unsigned char yType = y->GetType(); while ((i < xName.length()) && (i < yName.length())) - { - if (tolower (xName[i]) < tolower (yName[i])) - { - noWinner = false; - returnValue = true; - break; - } - else if (tolower (xName[i]) > tolower (yName[i])) { - noWinner = false; - returnValue = false; - break; + if (tolower (xName[i]) < tolower (yName[i])) + { + noWinner = false; + returnValue = true; + break; + } + else if (tolower (xName[i]) > tolower (yName[i])) + { + noWinner = false; + returnValue = false; + break; + } + i++; } - i++; - } if(noWinner) - { - if (xName.length() < yName.length()) - returnValue = true; - else - returnValue = false; - } + { + if (xName.length() < yName.length()) + returnValue = true; + else + returnValue = false; + } if(xType != yType) - { - if(xType == wxDIR_DIRS) - returnValue = true; - else - returnValue = false; - } + { + if(xType == wxDIR_DIRS) + returnValue = true; + else + returnValue = false; + } return returnValue; } -const wxTreeItemId& modelCDMIProjectTreeNode::GetId() const +const wxCDMTreeItemId& modelCDMIProjectTreeNode::GetId() const { return this->id; } @@ -109,12 +109,30 @@ const int& modelCDMIProjectTreeNode::GetLevel() const return this->level; } +modelCDMIProjectTreeNode* modelCDMIProjectTreeNode::GetParent() const +{ + return this->parent; +} + +std::vector modelCDMIProjectTreeNode::GetParents() const +{ + std::vector family; + modelCDMIProjectTreeNode* someFamily = this->parent; + while(someFamily != NULL) + { + family.push_back(someFamily); + someFamily = someFamily->GetParent(); + } + return family; + +} + const std::vector& modelCDMIProjectTreeNode::GetChildren() const { return this->children; } -void modelCDMIProjectTreeNode::SetId(const wxTreeItemId& id) +void modelCDMIProjectTreeNode::SetId(const wxCDMTreeItemId& id) { this->id = id; } @@ -145,10 +163,10 @@ const int& modelCDMIProjectTreeNode::GetLength() const bool modelCDMIProjectTreeNode::OpenInFileExplorer(std::string*& result) const { if (!CDMUtilities::openFileExplorer(this->GetPath())) - return true; - else - { - result = new std::string("Couldn't open file."); - return false; - } + return true; + else + { + result = new std::string("Couldn't open file."); + return false; + } }