michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* nsISupportsIterators.idl --- IDL defining general purpose iterators */ michael@0: michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: michael@0: /* michael@0: ... michael@0: */ michael@0: michael@0: michael@0: /** michael@0: * ... michael@0: */ michael@0: [scriptable, uuid(7330650e-1dd2-11b2-a0c2-9ff86ee97bed)] michael@0: interface nsIOutputIterator : nsISupports michael@0: { michael@0: /** michael@0: * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator. michael@0: * The iterator and the underlying container or sequence cooperate to |Release()| michael@0: * the replaced element, if any and if necessary, and to |AddRef()| the new element. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @param anElementToPut the element to place into the underlying container or sequence michael@0: */ michael@0: void putElement( in nsISupports anElementToPut ); michael@0: michael@0: /** michael@0: * Advance this iterator to the next position in the underlying container or sequence. michael@0: */ michael@0: void stepForward(); michael@0: }; michael@0: michael@0: /** michael@0: * ... michael@0: */ michael@0: [scriptable, uuid(85585e12-1dd2-11b2-a930-f6929058269a)] michael@0: interface nsIInputIterator : nsISupports michael@0: { michael@0: /** michael@0: * Retrieve (and |AddRef()|) the element this iterator currently points to. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @result a new reference to the element this iterator currently points to (if any) michael@0: */ michael@0: nsISupports getElement(); michael@0: michael@0: /** michael@0: * Advance this iterator to the next position in the underlying container or sequence. michael@0: */ michael@0: void stepForward(); michael@0: michael@0: /** michael@0: * Test if |anotherIterator| points to the same position in the underlying container or sequence. michael@0: * michael@0: * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence. michael@0: * michael@0: * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence michael@0: * @result true if |anotherIterator| points to the same position in the underlying container or sequence michael@0: */ michael@0: boolean isEqualTo( in nsISupports anotherIterator ); michael@0: michael@0: /** michael@0: * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points. michael@0: * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator. michael@0: * michael@0: * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator michael@0: */ michael@0: nsISupports clone(); michael@0: }; michael@0: michael@0: /** michael@0: * ... michael@0: */ michael@0: [scriptable, uuid(8da01646-1dd2-11b2-98a7-c7009045be7e)] michael@0: interface nsIForwardIterator : nsISupports michael@0: { michael@0: /** michael@0: * Retrieve (and |AddRef()|) the element this iterator currently points to. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @result a new reference to the element this iterator currently points to (if any) michael@0: */ michael@0: nsISupports getElement(); michael@0: michael@0: /** michael@0: * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator. michael@0: * The iterator and the underlying container or sequence cooperate to |Release()| michael@0: * the replaced element, if any and if necessary, and to |AddRef()| the new element. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @param anElementToPut the element to place into the underlying container or sequence michael@0: */ michael@0: void putElement( in nsISupports anElementToPut ); michael@0: michael@0: /** michael@0: * Advance this iterator to the next position in the underlying container or sequence. michael@0: */ michael@0: void stepForward(); michael@0: michael@0: /** michael@0: * Test if |anotherIterator| points to the same position in the underlying container or sequence. michael@0: * michael@0: * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence. michael@0: * michael@0: * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence michael@0: * @result true if |anotherIterator| points to the same position in the underlying container or sequence michael@0: */ michael@0: boolean isEqualTo( in nsISupports anotherIterator ); michael@0: michael@0: /** michael@0: * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points. michael@0: * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator. michael@0: * michael@0: * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator michael@0: */ michael@0: nsISupports clone(); michael@0: }; michael@0: michael@0: /** michael@0: * ... michael@0: */ michael@0: [scriptable, uuid(948defaa-1dd1-11b2-89f6-8ce81f5ebda9)] michael@0: interface nsIBidirectionalIterator : nsISupports michael@0: { michael@0: /** michael@0: * Retrieve (and |AddRef()|) the element this iterator currently points to. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @result a new reference to the element this iterator currently points to (if any) michael@0: */ michael@0: nsISupports getElement(); michael@0: michael@0: /** michael@0: * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator. michael@0: * The iterator and the underlying container or sequence cooperate to |Release()| michael@0: * the replaced element, if any and if necessary, and to |AddRef()| the new element. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @param anElementToPut the element to place into the underlying container or sequence michael@0: */ michael@0: void putElement( in nsISupports anElementToPut ); michael@0: michael@0: /** michael@0: * Advance this iterator to the next position in the underlying container or sequence. michael@0: */ michael@0: void stepForward(); michael@0: michael@0: /** michael@0: * Move this iterator to the previous position in the underlying container or sequence. michael@0: */ michael@0: void stepBackward(); michael@0: michael@0: /** michael@0: * Test if |anotherIterator| points to the same position in the underlying container or sequence. michael@0: * michael@0: * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence. michael@0: * michael@0: * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence michael@0: * @result true if |anotherIterator| points to the same position in the underlying container or sequence michael@0: */ michael@0: boolean isEqualTo( in nsISupports anotherIterator ); michael@0: michael@0: /** michael@0: * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points. michael@0: * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator. michael@0: * michael@0: * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator michael@0: */ michael@0: nsISupports clone(); michael@0: }; michael@0: michael@0: /** michael@0: * ... michael@0: */ michael@0: [scriptable, uuid(9bd6fdb0-1dd1-11b2-9101-d15375968230)] michael@0: interface nsIRandomAccessIterator : nsISupports michael@0: { michael@0: /** michael@0: * Retrieve (and |AddRef()|) the element this iterator currently points to. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @result a new reference to the element this iterator currently points to (if any) michael@0: */ michael@0: nsISupports getElement(); michael@0: michael@0: /** michael@0: * Retrieve (and |AddRef()|) an element at some offset from where this iterator currently points. michael@0: * The offset may be negative. |getElementAt(0)| is equivalent to |getElement()|. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @param anOffset a |0|-based offset from the position to which this iterator currently points michael@0: * @result a new reference to the indicated element (if any) michael@0: */ michael@0: nsISupports getElementAt( in int32_t anOffset ); michael@0: michael@0: /** michael@0: * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator. michael@0: * The iterator and the underlying container or sequence cooperate to |Release()| michael@0: * the replaced element, if any and if necessary, and to |AddRef()| the new element. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @param anElementToPut the element to place into the underlying container or sequence michael@0: */ michael@0: void putElement( in nsISupports anElementToPut ); michael@0: michael@0: /** michael@0: * Put |anElementToPut| into the underlying container or sequence at the position |anOffset| away from that currently pointed to by this iterator. michael@0: * The iterator and the underlying container or sequence cooperate to |Release()| michael@0: * the replaced element, if any and if necessary, and to |AddRef()| the new element. michael@0: * |putElementAt(0, obj)| is equivalent to |putElement(obj)|. michael@0: * michael@0: * The result is undefined if this iterator currently points outside the michael@0: * useful range of the underlying container or sequence. michael@0: * michael@0: * @param anOffset a |0|-based offset from the position to which this iterator currently points michael@0: * @param anElementToPut the element to place into the underlying container or sequence michael@0: */ michael@0: void putElementAt( in int32_t anOffset, in nsISupports anElementToPut ); michael@0: michael@0: /** michael@0: * Advance this iterator to the next position in the underlying container or sequence. michael@0: */ michael@0: void stepForward(); michael@0: michael@0: /** michael@0: * Move this iterator by |anOffset| positions in the underlying container or sequence. michael@0: * |anOffset| may be negative. |stepForwardBy(1)| is equivalent to |stepForward()|. michael@0: * |stepForwardBy(0)| is a no-op. michael@0: * michael@0: * @param anOffset a |0|-based offset from the position to which this iterator currently points michael@0: */ michael@0: void stepForwardBy( in int32_t anOffset ); michael@0: michael@0: /** michael@0: * Move this iterator to the previous position in the underlying container or sequence. michael@0: */ michael@0: void stepBackward(); michael@0: michael@0: /** michael@0: * Move this iterator backwards by |anOffset| positions in the underlying container or sequence. michael@0: * |anOffset| may be negative. |stepBackwardBy(1)| is equivalent to |stepBackward()|. michael@0: * |stepBackwardBy(n)| is equivalent to |stepForwardBy(-n)|. |stepBackwardBy(0)| is a no-op. michael@0: * michael@0: * @param anOffset a |0|-based offset from the position to which this iterator currently points michael@0: */ michael@0: void stepBackwardBy( in int32_t anOffset ); michael@0: michael@0: /** michael@0: * Test if |anotherIterator| points to the same position in the underlying container or sequence. michael@0: * michael@0: * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence. michael@0: * michael@0: * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence michael@0: * @result true if |anotherIterator| points to the same position in the underlying container or sequence michael@0: */ michael@0: boolean isEqualTo( in nsISupports anotherIterator ); michael@0: michael@0: /** michael@0: * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points. michael@0: * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator. michael@0: * michael@0: * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator michael@0: */ michael@0: nsISupports clone(); michael@0: }; michael@0: michael@0: %{C++ michael@0: %}