Salome HOME
Copyrights update
[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/
18 //
19 #ifndef SUIT_DATAOBJECT_ITERATOR_H
20 #define SUIT_DATAOBJECT_ITERATOR_H
21
22 #include "SUIT_DataObject.h"
23
24 /*!
25   Class provide data object iterator.
26 */
27 class SUIT_EXPORT SUIT_DataObjectIterator
28 {
29 public:
30   typedef enum { DepthLeft, DepthRight, BreadthLeft, BreadthRight, User } DetourType;
31
32   SUIT_DataObjectIterator( SUIT_DataObject* root, const int det, const bool fromTrueRoot = false );
33
34   virtual void      operator++();
35   SUIT_DataObject*  current() const;
36
37   int               depth() const;
38   int               detour() const;
39
40 protected: 
41   SUIT_DataObject*  parent( SUIT_DataObject* ) const;
42   SUIT_DataObject*  extreme( DataObjectList&, bool FromLeft ) const;
43   SUIT_DataObject*  globalSibling( SUIT_DataObject*, bool next ) const;
44
45 protected:
46   SUIT_DataObject*  myRoot;
47   SUIT_DataObject*  myCurrent;
48
49 private:
50   SUIT_DataObject*  myExtremeChild;
51   int               myDetourType, myCurrentLevel;
52 };
53
54 class SUIT_DataObjectLevelIterator : public SUIT_DataObjectIterator
55 {
56 public:
57   SUIT_DataObjectLevelIterator( SUIT_DataObject* root, const int start, const int end = 0,
58                                   const bool LeftToRight = true );
59   virtual void      operator++();
60
61 protected:
62   int myStartLevel;
63   int myEndLevel;
64 };
65
66 #endif