1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2000
20 * the Initial Developer. All Rights Reserved.
23 * Scott Collins <scc@netscape.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 /* nsISupportsIterators.idl --- IDL defining general purpose iterators */
42 #include
"nsISupports.idl"
53 [scriptable
, uuid(7330650e-1dd2
-11b2
-a0c2
-9ff86ee97bed
)]
54 interface nsIOutputIterator
: nsISupports
57 * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator.
58 * The iterator and the underlying container or sequence cooperate to |Release()|
59 * the replaced element, if any and if necessary, and to |AddRef()| the new element.
61 * The result is undefined if this iterator currently points outside the
62 * useful range of the underlying container or sequence.
64 * @param anElementToPut the element to place into the underlying container or sequence
66 void putElement
( in nsISupports anElementToPut
);
69 * Advance this iterator to the next position in the underlying container or sequence.
77 [scriptable
, uuid(85585e12
-1dd2
-11b2
-a930
-f6929058269a
)]
78 interface nsIInputIterator
: nsISupports
81 * Retrieve (and |AddRef()|) the element this iterator currently points to.
83 * The result is undefined if this iterator currently points outside the
84 * useful range of the underlying container or sequence.
86 * @result a new reference to the element this iterator currently points to (if any)
88 nsISupports getElement
();
91 * Advance this iterator to the next position in the underlying container or sequence.
96 * Test if |anotherIterator| points to the same position in the underlying container or sequence.
98 * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence.
100 * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence
101 * @result true if |anotherIterator| points to the same position in the underlying container or sequence
103 boolean isEqualTo
( in nsISupports anotherIterator
);
106 * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points.
107 * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator.
109 * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator
117 [scriptable
, uuid(8da01646
-1dd2
-11b2
-98a7
-c7009045be7e
)]
118 interface nsIForwardIterator
: nsISupports
121 * Retrieve (and |AddRef()|) the element this iterator currently points to.
123 * The result is undefined if this iterator currently points outside the
124 * useful range of the underlying container or sequence.
126 * @result a new reference to the element this iterator currently points to (if any)
128 nsISupports getElement
();
131 * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator.
132 * The iterator and the underlying container or sequence cooperate to |Release()|
133 * the replaced element, if any and if necessary, and to |AddRef()| the new element.
135 * The result is undefined if this iterator currently points outside the
136 * useful range of the underlying container or sequence.
138 * @param anElementToPut the element to place into the underlying container or sequence
140 void putElement
( in nsISupports anElementToPut
);
143 * Advance this iterator to the next position in the underlying container or sequence.
148 * Test if |anotherIterator| points to the same position in the underlying container or sequence.
150 * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence.
152 * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence
153 * @result true if |anotherIterator| points to the same position in the underlying container or sequence
155 boolean isEqualTo
( in nsISupports anotherIterator
);
158 * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points.
159 * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator.
161 * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator
169 [scriptable
, uuid(948defaa
-1dd1
-11b2
-89f6
-8ce81f5ebda9
)]
170 interface nsIBidirectionalIterator
: nsISupports
173 * Retrieve (and |AddRef()|) the element this iterator currently points to.
175 * The result is undefined if this iterator currently points outside the
176 * useful range of the underlying container or sequence.
178 * @result a new reference to the element this iterator currently points to (if any)
180 nsISupports getElement
();
183 * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator.
184 * The iterator and the underlying container or sequence cooperate to |Release()|
185 * the replaced element, if any and if necessary, and to |AddRef()| the new element.
187 * The result is undefined if this iterator currently points outside the
188 * useful range of the underlying container or sequence.
190 * @param anElementToPut the element to place into the underlying container or sequence
192 void putElement
( in nsISupports anElementToPut
);
195 * Advance this iterator to the next position in the underlying container or sequence.
200 * Move this iterator to the previous position in the underlying container or sequence.
205 * Test if |anotherIterator| points to the same position in the underlying container or sequence.
207 * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence.
209 * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence
210 * @result true if |anotherIterator| points to the same position in the underlying container or sequence
212 boolean isEqualTo
( in nsISupports anotherIterator
);
215 * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points.
216 * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator.
218 * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator
226 [scriptable
, uuid(9bd6fdb0
-1dd1
-11b2
-9101-d15375968230
)]
227 interface nsIRandomAccessIterator
: nsISupports
230 * Retrieve (and |AddRef()|) the element this iterator currently points to.
232 * The result is undefined if this iterator currently points outside the
233 * useful range of the underlying container or sequence.
235 * @result a new reference to the element this iterator currently points to (if any)
237 nsISupports getElement
();
240 * Retrieve (and |AddRef()|) an element at some offset from where this iterator currently points.
241 * The offset may be negative. |getElementAt(0)| is equivalent to |getElement()|.
243 * The result is undefined if this iterator currently points outside the
244 * useful range of the underlying container or sequence.
246 * @param anOffset a |0|-based offset from the position to which this iterator currently points
247 * @result a new reference to the indicated element (if any)
249 nsISupports getElementAt
( in PRInt32 anOffset
);
252 * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator.
253 * The iterator and the underlying container or sequence cooperate to |Release()|
254 * the replaced element, if any and if necessary, and to |AddRef()| the new element.
256 * The result is undefined if this iterator currently points outside the
257 * useful range of the underlying container or sequence.
259 * @param anElementToPut the element to place into the underlying container or sequence
261 void putElement
( in nsISupports anElementToPut
);
264 * Put |anElementToPut| into the underlying container or sequence at the position |anOffset| away from that currently pointed to by this iterator.
265 * The iterator and the underlying container or sequence cooperate to |Release()|
266 * the replaced element, if any and if necessary, and to |AddRef()| the new element.
267 * |putElementAt(0, obj)| is equivalent to |putElement(obj)|.
269 * The result is undefined if this iterator currently points outside the
270 * useful range of the underlying container or sequence.
272 * @param anOffset a |0|-based offset from the position to which this iterator currently points
273 * @param anElementToPut the element to place into the underlying container or sequence
275 void putElementAt
( in PRInt32 anOffset
, in nsISupports anElementToPut
);
278 * Advance this iterator to the next position in the underlying container or sequence.
283 * Move this iterator by |anOffset| positions in the underlying container or sequence.
284 * |anOffset| may be negative. |stepForwardBy(1)| is equivalent to |stepForward()|.
285 * |stepForwardBy(0)| is a no-op.
287 * @param anOffset a |0|-based offset from the position to which this iterator currently points
289 void stepForwardBy
( in PRInt32 anOffset
);
292 * Move this iterator to the previous position in the underlying container or sequence.
297 * Move this iterator backwards by |anOffset| positions in the underlying container or sequence.
298 * |anOffset| may be negative. |stepBackwardBy(1)| is equivalent to |stepBackward()|.
299 * |stepBackwardBy(n)| is equivalent to |stepForwardBy(-n)|. |stepBackwardBy(0)| is a no-op.
301 * @param anOffset a |0|-based offset from the position to which this iterator currently points
303 void stepBackwardBy
( in PRInt32 anOffset
);
306 * Test if |anotherIterator| points to the same position in the underlying container or sequence.
308 * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence.
310 * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence
311 * @result true if |anotherIterator| points to the same position in the underlying container or sequence
313 boolean isEqualTo
( in nsISupports anotherIterator
);
316 * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points.
317 * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator.
319 * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator