Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / SUIT / SUIT_DataObjectIterator.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef SUIT_DATAOBJECT_ITERATOR_H
20 #define SUIT_DATAOBJECT_ITERATOR_H
21
22 #include "SUIT_DataObject.h"
23
24 /*!
25   \class SUIT_DataObjectIterator
26   Provides functionality of SUIT tree detour
27   It is possible to use "to-depth" or "to-breadth" detour and
28   to control level detour (from left or from right)
29 */
30 class SUIT_EXPORT SUIT_DataObjectIterator
31 {
32 public:
33   typedef enum { DepthLeft, DepthRight, BreadthLeft, BreadthRight, User } DetourType;
34
35   SUIT_DataObjectIterator( SUIT_DataObject* root, const int det, const bool fromTrueRoot = false );
36
37   virtual void      operator++();
38   SUIT_DataObject*  current() const;
39
40   int               depth() const;
41   int               detour() const;
42
43 protected: 
44   SUIT_DataObject*  parent( SUIT_DataObject* ) const;
45   SUIT_DataObject*  extreme( DataObjectList&, bool FromLeft ) const;
46   SUIT_DataObject*  globalSibling( SUIT_DataObject*, bool next ) const;
47
48 protected:
49   SUIT_DataObject*  myRoot;
50   SUIT_DataObject*  myCurrent;
51
52 private:
53   SUIT_DataObject*  myExtremeChild;
54   int               myDetourType, myCurrentLevel;
55 };
56
57 /*!
58   \class SUIT_DataObjectIterator
59   Provides functionality of SUIT tree detour between certain levels 
60   Only "to-breadth" detour is used
61 */
62 class SUIT_DataObjectLevelIterator : public SUIT_DataObjectIterator
63 {
64 public:
65   SUIT_DataObjectLevelIterator( SUIT_DataObject* root, const int start, const int end = 0,
66                                   const bool LeftToRight = true );
67   virtual void      operator++();
68
69 protected:
70   int myStartLevel;
71   int myEndLevel;
72 };
73
74 #endif