00001 00002 // exotkTree_TreeNode.hxx 00004 // Copyright (C) 2001 Stephane Routelous 00005 // 00006 // This file is part of exoTK. 00007 // 00008 // exoTK is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // exoTK is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with exoTK; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00028 #ifndef _exotkTree_TreeNode_HeaderFile 00029 #define _exotkTree_TreeNode_HeaderFile 00030 00031 #if _MSC_VER > 1000 00032 #pragma once 00033 #endif // _MSC_VER > 1000 00034 00035 #ifndef _MMgt_TShared_HeaderFile 00036 #include <MMgt_TShared.hxx> 00037 #endif 00038 #ifndef _Handle_exotkTree_TreeNode_HeaderFile 00039 #include <Handle_exotkTree_TreeNode.hxx> 00040 #endif 00041 #ifndef _Handle_exotkTree_Tree_HeaderFile 00042 #include <Handle_exotkTree_Tree.hxx> 00043 #endif 00044 #ifndef _exotkTree_ListOfTreeNode_HeaderFile 00045 #include <exotkTree_ListOfTreeNode.hxx> 00046 #endif 00047 #ifndef _TCollection_AsciiString_HeaderFile 00048 #include <TCollection_AsciiString.hxx> 00049 #endif 00050 #ifndef _Standard_DefineHandle_HeaderFile 00051 #include <Standard_DefineHandle.hxx> 00052 #endif 00053 00054 class exotkTree_ListIteratorOfListOfTreeNode; 00055 00061 class exotkTree_TreeNode : public MMgt_TShared 00062 { 00063 public: 00064 00072 inline void* operator new(size_t,void* anAddress) 00073 { 00074 return anAddress; 00075 } 00076 00083 inline void* operator new(size_t size) 00084 { 00085 return Standard::Allocate(size); 00086 } 00087 00094 inline void operator delete(void *anAddress) 00095 { 00096 if (anAddress) Standard::Free((Standard_Address&)anAddress); 00097 } 00098 00103 Standard_EXPORT exotkTree_TreeNode(); 00104 00109 Standard_EXPORT virtual ~exotkTree_TreeNode(); 00110 00111 00117 Standard_EXPORT virtual void SetData(const Handle_Standard_Transient& aData); 00118 00125 Standard_EXPORT virtual Handle_Standard_Transient Data(); 00126 00132 Standard_EXPORT virtual Standard_Boolean HasData(); 00133 00134 00140 Standard_EXPORT virtual Standard_Boolean IsRoot(); 00141 00147 Standard_EXPORT virtual Standard_Boolean HasChildren(); 00148 00149 00155 Standard_EXPORT virtual Handle_exotkTree_TreeNode FirstChild(); 00156 00162 Standard_EXPORT virtual Handle_exotkTree_TreeNode LastChild(); 00169 Standard_EXPORT virtual void Children(exotkTree_ListOfTreeNode& aChildList); 00170 00176 Standard_EXPORT virtual Standard_Boolean HasParent(); 00177 00184 Standard_EXPORT virtual Handle_exotkTree_TreeNode Parent(); 00185 00192 Standard_EXPORT virtual void SetParent(const Handle_exotkTree_TreeNode& aParent); 00193 00194 00200 Standard_EXPORT virtual void SetTree(const Handle_exotkTree_Tree& aTree); 00201 00207 Standard_EXPORT virtual Handle_exotkTree_Tree Tree(); 00208 00214 Standard_EXPORT virtual Standard_Boolean HasTree(); 00215 00216 00223 Standard_EXPORT virtual TCollection_AsciiString SetName(const TCollection_AsciiString& aName); 00224 00230 Standard_EXPORT virtual TCollection_AsciiString Name(); 00231 00232 00239 Standard_EXPORT virtual Standard_Boolean SetChecked(const Standard_Boolean aCheckStatus); 00240 00246 Standard_EXPORT virtual Standard_Boolean IsChecked(); 00247 00248 00256 Standard_EXPORT virtual Standard_Boolean FindChild(const TCollection_AsciiString& aNodeToFind,Handle_exotkTree_TreeNode& aFoundNode); 00257 00258 00265 Standard_EXPORT virtual Standard_Boolean AppendChild(const Handle_exotkTree_TreeNode& aChildToAppend); 00266 00273 Standard_EXPORT virtual Standard_Boolean PrependChild(const Handle_exotkTree_TreeNode& aChildToPrepend); 00274 00282 Standard_EXPORT virtual Standard_Boolean InsertChildAfter(const Handle_exotkTree_TreeNode& aChildToInsert,const Handle_exotkTree_TreeNode& After); 00283 00284 00292 Standard_EXPORT virtual Standard_Boolean InsertChildAfter(const Handle_exotkTree_TreeNode& aChildToInsert,const TCollection_AsciiString& After); 00300 Standard_EXPORT virtual Standard_Boolean InsertChildBefore(const Handle_exotkTree_TreeNode& aChildToInsert,const Handle_exotkTree_TreeNode& Before); 00301 00309 Standard_EXPORT virtual Standard_Boolean InsertChildBefore(const Handle_exotkTree_TreeNode& aChildToInsert,const TCollection_AsciiString& Before); 00310 00316 Standard_EXPORT friend Handle_Standard_Type& exotkTree_TreeNode_Type_(); 00317 00323 Standard_EXPORT const Handle_Standard_Type& DynamicType() const; 00324 00331 Standard_EXPORT Standard_Boolean IsKind(const Handle_Standard_Type&) const; 00332 00333 protected: 00334 00335 00343 Standard_EXPORT virtual Standard_Boolean FindChild(const Handle_exotkTree_TreeNode& aNodeToFind,exotkTree_ListIteratorOfListOfTreeNode& anIterator); 00344 00352 Standard_EXPORT virtual Standard_Boolean FindChild(const TCollection_AsciiString& aNodeToFind,exotkTree_ListIteratorOfListOfTreeNode& anIterator); 00353 00355 Handle_exotkTree_TreeNode myParent; 00356 00358 Handle_Standard_Transient myData; 00359 00361 Handle_exotkTree_Tree myTree; 00362 00364 exotkTree_ListOfTreeNode myChildren; 00365 00367 Standard_Boolean myIsChecked; 00368 00370 TCollection_AsciiString myName; 00371 00372 }; 00373 00374 #endif
1.2.12 written by Dimitri van Heesch,
© 1997-2001