0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / TCollection / TCollection_HSequence.cdl
CommitLineData
b311480e 1-- Created on: 1992-11-26
2-- Created by: Mireille MERCIEN
3-- Copyright (c) 1992-1999 Matra Datavision
4-- Copyright (c) 1999-2012 OPEN CASCADE SAS
5--
6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
8-- except in compliance with the License. Please obtain a copy of the License
9-- at http://www.opencascade.org and read it completely before using this file.
10--
11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13--
14-- The Original Code and all software distributed under the License is
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23generic class HSequence from TCollection
24 (Item as any;
25 TheSequence as any) -- Sequence from TCollection(Item))
26inherits TShared from MMgt
27
28 ---Purpose: A sequence of items indexed by an integer.
29 -- Sequences have about the same goal as unidimensional
30 -- arrays (TCollection_HArray1): they are commonly used
31 -- as elementary data structures for more complex objects.
32 -- But a sequence is a structure of variable size: sequences
33 -- avoid the use of large and quasi-empty arrays. Exploring
34 -- a sequence data structure is efficient when the exploration
35 -- is done in sequence; elsewhere a sequence item takes
36 -- longer to be read than an array item. Note also that
37 -- sequences are not efficient when they have to support
38 -- numerous algorithmic explorations: a map is better for that purpose.
39 -- HSequence objects are handles to sequences.
40 -- - HSequence sequences may be shared by several objects.
41 -- - You may use a TCollection_Sequence structure to
42 -- have the actual sequence.
43 -- HSequence is a generic class which depends on two parameters:
44 -- - Item, the type of element in the sequence,
45 -- - Seq, the actual type of sequence handled by
46 -- HSequence. This is an instantiation with Item of the
47 -- TCollection_Sequence generic class.A
48
49raises
50 NoSuchObject from Standard,
51 OutOfRange from Standard
52
53is
54 Create returns mutable HSequence from TCollection;
55 ---Purpose: Constructs an empty sequence.
56 -- Use:
57 -- - the function Append or Prepend to add an item or
58 -- a collection of items at the end, or at the beginning of the sequence,
59 -- - the function InsertAfter or InsertBefore to add an
60 -- item or a collection of items at any position in the sequence,
61 -- - the function SetValue or ChangeValue to assign a
62 -- new value to an item of the sequence,
63 -- - the function Value to read an item of the sequence,
64 -- - the function Remove to remove an item at any position in the sequence.
65 ---C++: inline
66
67 IsEmpty(me) returns Boolean;
68 ---Level: Public
69 ---Purpose: returns True if the sequence <me> contains no elements.
70 ---C++: inline
71
72
73 Length(me) returns Integer;
74 ---Level: Public
75 ---Purpose: Returns the number of element(s) in the
76 -- sequence. Returns zero if the sequence is empty.
77 --
78 ---C++: inline
79
80 Clear(me : mutable);
81 ---Level: Public
82 ---Purpose: Removes all element(s) of the sequence <me>
83 -- Example:
84 -- before
85 -- me = (A B C)
86 -- after
87 -- me = ()
88
89 Append(me : mutable; anItem : Item);
90 ---Level: Public
91 ---Purpose: Appends <anItem> at the end of <me>.
92 -- Example:
93 -- before
94 -- me = (A B C)
95 -- after
96 -- me = (A B C anItem)
97
98 Append(me : mutable; aSequence : HSequence);
99 ---Level: Public
100 ---Purpose: Concatenates <aSequence> at the end of <me>.
101 -- Example:
102 -- before
103 -- me = (A B C)
104 -- aSequence = (D E F)
105 -- after
106 -- me = (A B C D E F)
107 -- aSequence = (D E F)
108
109
110 Prepend(me : mutable; anItem : Item);
111 ---Level: Public
112 ---Purpose: Add <anItem> at the beginning of <me>.
113 -- Example:
114 -- before
115 -- me = (A B C)
116 -- after
117 -- me = (anItem A B C )
118
119 Prepend(me : mutable; aSequence : HSequence);
120 ---Purpose: Concatenates <aSequence> at the beginning of <me>.
121 -- Example:
122 -- before
123 -- me = (A B C)
124 -- aSequence = (D E F)
125 -- after me = (D E F A B C)
126 -- aSequence = (D E F)
127
128 Reverse(me : mutable);
129 ---Purpose: Reverses the order of items on <me>.The first one becomes the last one and inversely.
130 -- Example:
131 -- before
132 -- me = (A B C)
133 -- after
134 -- me = (C B A)
135
136 InsertBefore(me : mutable; anIndex : Integer; anItem : Item)
137 raises OutOfRange from Standard;
138 ---Purpose: Inserts <anItem> in <me> before the position <anIndex>.
139 -- Raises an exception if the anIndex is out of bounds.
140 -- Example:
141 -- before
142 -- me = (A B D), anIndex = 3, anItem = C
143 -- after
144 -- me = (A B C D )
145
146 InsertBefore(me : mutable ; anIndex : Integer; aSequence : HSequence)
147 raises OutOfRange from Standard;
148 ---Purpose: Inserts the sequence <aSequence> in <me> before
149 -- the position <anIndex>.
150 -- Raises an exception if the anIndex is out of bounds.
151 -- Example:
152 -- before
153 -- me = (A B F), anIndex = 3, aSequence = (C D E)
154 -- after
155 -- me = (A B C D E F)
156 -- aSequence = (C D E)
157
158 InsertAfter(me : mutable; anIndex : Integer; anItem : Item)
159 raises OutOfRange from Standard;
160 ---Purpose: Inserts <anItem> in <me> after the position
161 -- <anIndex>.
162 -- Raises an exception if anIndex is out of bound.
163 -- Example:
164 -- before
165 -- me = (A B C), anIndex = 3, anItem = D
166 -- after
167 -- me = (A B C D)
168
169 InsertAfter(me : mutable ; anIndex : Integer; aSequence : HSequence)
170 raises OutOfRange from Standard;
171 ---Purpose: Inserts the sequence <aSequence> in <me>
172 -- after the position <anIndex>.
173 -- Raises an exception if anIndex is out of bound.
174 -- Example:
175 -- before
176 -- me = (A B C), anIndex = 3, aSequence = (D E F)
177 -- after
178 -- me = (A B C D E F)
179 -- aSequence = (D E F)
180
181 Exchange(me : mutable; anIndex, anOtherIndex : Integer)
182 raises OutOfRange from Standard;
183 ---Purpose: Swaps elements which are located at
184 -- positions <anIndex> and <anOtherIndex> in <me>.
185 -- Raises an exception if anIndex or anOtherIndex is out of bound.
186 -- Example:
187 -- before
188 -- me = (A B C), anIndex = 1, anOtherIndex = 3
189 -- after
190 -- me = (C B A)
191
192
193 Split(me : mutable; anIndex : Integer)
194 returns mutable HSequence
195 raises OutOfRange from Standard
196 ---Purpose: Keeps in <me> the items 1 to <anIndex>-1 and
197 -- returns the items <anIndex> to the end.
198 -- Example:
199 -- before
200 -- me = (A B C D) ,anIndex = 3
201 -- after
202 -- me = (A B)
203 -- returns (C D)
204 is static;
205
206 SetValue(me : mutable; anIndex : Integer; anItem : Item)
207 raises OutOfRange from Standard
208 ---Purpose: Sets <anItem> to be the item at position
209 -- <anIndex> in <me>.
210 -- Raises an exception if anIndex is out of bounds
211 -- Example:
212 -- before
213 -- me = (A B D), anIndex = 3, anItem = C
214 -- after
215 -- me = (A B C)
216 is static;
217
218 Value(me; anIndex : Integer) returns any Item
219 raises OutOfRange from Standard
220 ---Purpose: Returns the Item at position <anIndex> in <me>.
221 -- Raises an exception if the anIndex is out of bound
222 -- Example:
223 -- before
224 -- me = (A B C), anIndex = 1
225 -- after
226 -- me = (A B C)
227 -- returns
228 -- A
229 ---C++: return const &
230 is static;
231
232 ChangeValue(me : mutable; anIndex : Integer) returns any Item
233 raises OutOfRange from Standard
234 ---Purpose: Returns the Item at position <anIndex> in <me>.
235 -- Raises an exception if the anIndex is out of bound.
236 -- Example:
237 -- before
238 -- me = (A B C), anIndex = 1
239 -- after
240 -- me = (A B C)
241 -- returns
242 -- A
243 ---C++: return &
244 is static;
245
246 Remove(me : mutable; anIndex : Integer)
247 raises OutOfRange from Standard;
248 ---Purpose: Removes from <me> the item at position
249 -- <anIndex>.
250 -- Raises an exception if anIndex is out of bounds.
251 -- Example:
252 -- before
253 -- me = (A B C), anIndex = 3
254 -- after
255 -- me = (A B)
256
257 Remove(me : mutable; fromIndex, toIndex : Integer)
258 raises OutOfRange from Standard;
259 ---Purpose: Removes from <me> all the items of
260 -- positions between <fromIndex> and <toIndex>.
261 -- Raises an exception if the indices are out of bounds.
262 -- Example:
263 -- before
264 -- me = (A B C D E F), fromIndex = 1 toIndex = 3
265 -- after
266 -- me = (D E F)
267
268 Sequence(me) returns TheSequence;
269 ---Purpose: Returns the Seq sequence used as a field by this
270 -- sequence; the returned sequence is not modifiable;
271 ---C++: return const &
272 ---C++: inline
273
274 ChangeSequence(me : mutable) returns TheSequence;
275 ---Purpose: - Returns a modifiable reference on the Seq
276 -- sequence used as a field by this sequence, in order to modify it.
277 ---C++: return &
278 ---C++: inline
279
280 ShallowCopy(me) returns mutable like me;
281 ---Purpose: function call
282 ---C++: function call
283
284 -- IsSameState (me; other : like me) returns Boolean;
285
286fields
287 mySequence : TheSequence;
288end;
289
290
291