0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / TObj / TObj_LabelIterator.hxx
CommitLineData
b311480e 1// Created on: 2004-11-23
2// Created by: Pavel TELKOV
973c2be1 3// Copyright (c) 2004-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 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
31class 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.
0f57ab75 59 virtual Standard_Boolean More () const Standard_OVERRIDE
7fd59977 60 { return !myNode.IsNull(); }
61
62 //! Move to the next Item
79104795 63 virtual Standard_EXPORT void Next () Standard_OVERRIDE;
7fd59977 64
65 //! Returns the current item
0f57ab75 66 virtual Handle(TObj_Object) Value () const Standard_OVERRIDE
7fd59977 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
0f57ab75 79 virtual void MakeStep() = 0;
7fd59977 80
81 protected:
82 /**
83 * Internal methods
84 */
85
86 //! Initialize Iterator by the theLabel
0f57ab75 87 void Init(const TDF_Label& theLabel,
7fd59977 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
92efcf78 102 DEFINE_STANDARD_RTTIEXT(TObj_LabelIterator,TObj_ObjectIterator)
7fd59977 103};
104
105//! Define handle class for TObj_LabelIterator
106DEFINE_STANDARD_HANDLE(TObj_LabelIterator,TObj_ObjectIterator)
107
108#endif
109
110#ifdef _MSC_VER
111#pragma once
112#endif