xpcom/ds/nsIMutableArray.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsIArray.idl"
michael@0 7
michael@0 8 /**
michael@0 9 * nsIMutableArray
michael@0 10 * A separate set of methods that will act on the array. Consumers of
michael@0 11 * nsIArray should not QueryInterface to nsIMutableArray unless they
michael@0 12 * own the array.
michael@0 13 *
michael@0 14 * As above, it is legal to add null elements to the array. Note also
michael@0 15 * that null elements can be created as a side effect of
michael@0 16 * insertElementAt(). Conversely, if insertElementAt() is never used,
michael@0 17 * and null elements are never explicitly added to the array, then it
michael@0 18 * is guaranteed that queryElementAt() will never return a null value.
michael@0 19 *
michael@0 20 * Any of these methods may throw NS_ERROR_OUT_OF_MEMORY when the
michael@0 21 * array must grow to complete the call, but the allocation fails.
michael@0 22 */
michael@0 23 [scriptable, uuid(af059da0-c85b-40ec-af07-ae4bfdc192cc)]
michael@0 24 interface nsIMutableArray : nsIArray
michael@0 25 {
michael@0 26 /**
michael@0 27 * appendElement()
michael@0 28 *
michael@0 29 * Append an element at the end of the array.
michael@0 30 *
michael@0 31 * @param element The element to append.
michael@0 32 * @param weak Whether or not to store the element using a weak
michael@0 33 * reference.
michael@0 34 * @throws NS_ERROR_FAILURE when a weak reference is requested,
michael@0 35 * but the element does not support
michael@0 36 * nsIWeakReference.
michael@0 37 */
michael@0 38 void appendElement(in nsISupports element, in boolean weak);
michael@0 39
michael@0 40 /**
michael@0 41 * removeElementAt()
michael@0 42 *
michael@0 43 * Remove an element at a specific position, moving all elements
michael@0 44 * stored at a higher position down one.
michael@0 45 * To remove a specific element, use indexOf() to find the index
michael@0 46 * first, then call removeElementAt().
michael@0 47 *
michael@0 48 * @param index the position of the item
michael@0 49 *
michael@0 50 */
michael@0 51 void removeElementAt(in unsigned long index);
michael@0 52
michael@0 53 /**
michael@0 54 * insertElementAt()
michael@0 55 *
michael@0 56 * Insert an element at the given position, moving the element
michael@0 57 * currently located in that position, and all elements in higher
michael@0 58 * position, up by one.
michael@0 59 *
michael@0 60 * @param element The element to insert
michael@0 61 * @param index The position in the array:
michael@0 62 * If the position is lower than the current length
michael@0 63 * of the array, the elements at that position and
michael@0 64 * onwards are bumped one position up.
michael@0 65 * If the position is equal to the current length
michael@0 66 * of the array, the new element is appended.
michael@0 67 * An index lower than 0 or higher than the current
michael@0 68 * length of the array is invalid and will be ignored.
michael@0 69 *
michael@0 70 * @throws NS_ERROR_FAILURE when a weak reference is requested,
michael@0 71 * but the element does not support
michael@0 72 * nsIWeakReference.
michael@0 73 */
michael@0 74 void insertElementAt(in nsISupports element, in unsigned long index,
michael@0 75 in boolean weak);
michael@0 76
michael@0 77 /**
michael@0 78 * replaceElementAt()
michael@0 79 *
michael@0 80 * Replace the element at the given position.
michael@0 81 *
michael@0 82 * @param element The new element to insert
michael@0 83 * @param index The position in the array
michael@0 84 * If the position is lower than the current length
michael@0 85 * of the array, an existing element will be replaced.
michael@0 86 * If the position is equal to the current length
michael@0 87 * of the array, the new element is appended.
michael@0 88 * If the position is higher than the current length
michael@0 89 * of the array, empty elements are appended followed
michael@0 90 * by the new element at the specified position.
michael@0 91 * An index lower than 0 is invalid and will be ignored.
michael@0 92 *
michael@0 93 * @param weak Whether or not to store the new element using a weak
michael@0 94 * reference.
michael@0 95 *
michael@0 96 * @throws NS_ERROR_FAILURE when a weak reference is requested,
michael@0 97 * but the element does not support
michael@0 98 * nsIWeakReference.
michael@0 99 */
michael@0 100 void replaceElementAt(in nsISupports element, in unsigned long index,
michael@0 101 in boolean weak);
michael@0 102
michael@0 103
michael@0 104 /**
michael@0 105 * clear()
michael@0 106 *
michael@0 107 * clear the entire array, releasing all stored objects
michael@0 108 */
michael@0 109 void clear();
michael@0 110 };

mercurial