1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
-- File: TDF_ChildIterator.cdl
-- ------------------------
-- Author: DAUTRY Philippe
-- <fid@fox.paris1.matra-dtv.fr>
---Copyright: MATRA DATAVISION 1997
---Version: 0.0
---History: Version Date Purpose
-- 0.0 Feb 4 1997 Creation
class ChildIterator from TDF
---Purpose: Iterates on the children of a label, at the first
-- level only. It is possible to ask the iterator to
-- explore all the sub label levels of the given one,
-- with the option "allLevels".
uses
Label from TDF,
LabelNodePtr from TDF
is
Create
returns ChildIterator from TDF;
---Purpose: Creates an empty iterator object to
-- explore the children of a label.
Create(aLabel : Label from TDF;
allLevels : Boolean from Standard = Standard_False)
returns ChildIterator from TDF;
---Purpose: Constructs the iterator object defined by
-- the label aLabel. Iterates on the children of the given label. If
-- <allLevels> option is set to true, it explores not
-- only the first, but all the sub label levels.
Initialize(me : in out;
aLabel : Label from TDF;
allLevels : Boolean from Standard = Standard_False);
---Purpose: Initializes the iteration on the children of the
-- given label.
-- If <allLevels> option is set to true,
-- it explores not only the first, but all the sub
-- label levels.
-- If allLevels is false, only the first level of
-- child labels is explored.
-- In the example below, the label is iterated
-- using Initialize, More and Next and its
-- child labels dumped using TDF_Tool::Entry.
-- Example
-- void DumpChildren(const
-- TDF_Label& aLabel)
-- {
-- TDF_ChildIterator it;
-- TCollection_AsciiString es;
-- for
-- (it.Initialize(aLabel,Standard_True);
-- it.More(); it.Next()){
-- TDF_Tool::Entry(it.Value(),es);
-- cout << as.ToCString() << endl;
-- }
-- }
More(me) returns Boolean;
---Purpose: Returns true if a current label is found in the
-- iteration process.
--
---C++: inline
Next(me : in out);
---Purpose: Move the current iteration to the next Item.
NextBrother(me : in out);
---Purpose: Moves this iteration to the next brother
-- label. A brother label is one with the same
-- father as an initial label.
-- Use this function when the non-empty
-- constructor or Initialize has allLevels set to
-- true. The result is that the iteration does not
-- explore the children of the current label.
-- This method is interesting only with
-- "allLevels" behavior, because it avoids to explore
-- the current label children.
Value(me) returns Label from TDF;
---Purpose: Returns the current label; or, if there is
-- none, a null label.
--
---C++: return const
---C++: inline
fields
myNode : LabelNodePtr from TDF;
myFirstLevel : Integer from Standard;
end ChildIterator;
|