Warnings on vc14 were eliminated
[occt.git] / src / TObj / TObj_LabelIterator.hxx
1 // Created on: 2004-11-23
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2004-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 // The original implementation Copyright: (C) RINA S.p.A
17
18 #ifndef TObj_LabelIterator_HeaderFile
19 #define TObj_LabelIterator_HeaderFile
20
21 #include <TObj_Object.hxx>
22
23 #include <TDF_Label.hxx>
24 #include <TDF_ChildIterator.hxx>
25 #include <TObj_ObjectIterator.hxx>
26
27 /**
28 * This class is a basis for OCAF based iterators.
29 */
30
31 class TObj_LabelIterator : public TObj_ObjectIterator
32 {
33   
34  protected:
35   /**
36   * Constructor
37   */
38   
39   //! Creates an Empty Iterator
40   Standard_EXPORT TObj_LabelIterator();
41   
42  public:
43   /**
44   * Constructor
45   */
46   
47   //! Creates an iterator an initialize it by theLabel and recursive flag.
48   //! If isRecursive is Standard_True make recursive iterations
49   Standard_EXPORT TObj_LabelIterator
50                         (const TDF_Label& theLabel,
51                          const Standard_Boolean isRecursive = Standard_False);
52
53  public:
54   /**
55   * Redefined methods
56   */
57   
58   //! Returns True if there is a current Item in the iteration.
59   virtual Standard_EXPORT Standard_Boolean More () const Standard_OVERRIDE
60     { return !myNode.IsNull(); }
61   
62   //! Move to the next Item
63   virtual Standard_EXPORT void Next () Standard_OVERRIDE;
64    
65   //! Returns the current item
66   virtual Standard_EXPORT Handle(TObj_Object) Value () const Standard_OVERRIDE
67     { return myObject; }
68   
69   //! Returns the label of the current item
70   inline const TDF_Label& LabelValue() const
71     { return myNode; }
72   
73  protected:
74   /**
75   * Iterating methods
76   */
77   
78   //! Shifts iterator to the next object
79   virtual Standard_EXPORT void MakeStep() = 0;
80   
81  protected:
82   /**
83   * Internal methods
84   */
85   
86   //! Initialize Iterator by the theLabel
87   Standard_EXPORT void Init(const TDF_Label& theLabel,
88                             const Standard_Boolean isRecursive = Standard_False)
89     { myIterator.Initialize(theLabel,isRecursive); }
90   
91   
92  protected:
93   /**
94   * Fields
95   */
96   TDF_Label               myNode;     //!< Current node
97   TDF_ChildIterator       myIterator; //!< OCAF Child iterator
98   Handle(TObj_Object)     myObject;   //!< Current Object
99   
100  public:
101   //! CASCADE RTTI
102   DEFINE_STANDARD_RTTIEXT(TObj_LabelIterator,TObj_ObjectIterator)
103 };
104
105 //! Define handle class for TObj_LabelIterator
106 DEFINE_STANDARD_HANDLE(TObj_LabelIterator,TObj_ObjectIterator)
107
108 #endif
109
110 #ifdef _MSC_VER
111 #pragma once
112 #endif