PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/gecko_api/include/nsIMutableArray.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 228 lines | 80 code | 34 blank | 114 comment | 0 complexity | 7130fa48afc641d58bdcdb6afe0eb170 MD5 | raw file
  1/*
  2 * DO NOT EDIT.  THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_Depend/mozilla/xpcom/ds/nsIMutableArray.idl
  3 */
  4
  5#ifndef __gen_nsIMutableArray_h__
  6#define __gen_nsIMutableArray_h__
  7
  8
  9#ifndef __gen_nsIArray_h__
 10#include "nsIArray.h"
 11#endif
 12
 13/* For IDL files that don't want to include root IDL files. */
 14#ifndef NS_NO_VTABLE
 15#define NS_NO_VTABLE
 16#endif
 17
 18/* starting interface:    nsIMutableArray */
 19#define NS_IMUTABLEARRAY_IID_STR "af059da0-c85b-40ec-af07-ae4bfdc192cc"
 20
 21#define NS_IMUTABLEARRAY_IID \
 22  {0xaf059da0, 0xc85b, 0x40ec, \
 23    { 0xaf, 0x07, 0xae, 0x4b, 0xfd, 0xc1, 0x92, 0xcc }}
 24
 25/**
 26 * nsIMutableArray
 27 * A separate set of methods that will act on the array. Consumers of
 28 * nsIArray should not QueryInterface to nsIMutableArray unless they
 29 * own the array.
 30 *
 31 * As above, it is legal to add null elements to the array. Note also
 32 * that null elements can be created as a side effect of
 33 * insertElementAt(). Conversely, if insertElementAt() is never used,
 34 * and null elements are never explicitly added to the array, then it
 35 * is guaranteed that queryElementAt() will never return a null value.
 36 *
 37 * Any of these methods may throw NS_ERROR_OUT_OF_MEMORY when the
 38 * array must grow to complete the call, but the allocation fails.
 39 *
 40 * @status FROZEN
 41 */
 42class NS_NO_VTABLE NS_SCRIPTABLE nsIMutableArray : public nsIArray {
 43 public: 
 44
 45  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMUTABLEARRAY_IID)
 46
 47  /**
 48     * appendElement()
 49     * 
 50     * Append an element at the end of the array.
 51     *
 52     * @param element The element to append.
 53     * @param weak    Whether or not to store the element using a weak
 54     *                reference.
 55     * @throws NS_ERROR_FAILURE when a weak reference is requested,
 56     *                          but the element does not support
 57     *                          nsIWeakReference.
 58     */
 59  /* void appendElement (in nsISupports element, in boolean weak); */
 60  NS_SCRIPTABLE NS_IMETHOD AppendElement(nsISupports *element, PRBool weak) = 0;
 61
 62  /**
 63     * removeElementAt()
 64     * 
 65     * Remove an element at a specific position, moving all elements
 66     * stored at a higher position down one.
 67     * To remove a specific element, use indexOf() to find the index
 68     * first, then call removeElementAt().
 69     *
 70     * @param index the position of the item
 71     *
 72     */
 73  /* void removeElementAt (in unsigned long index); */
 74  NS_SCRIPTABLE NS_IMETHOD RemoveElementAt(PRUint32 index) = 0;
 75
 76  /**
 77     * insertElementAt()
 78     *
 79     * Insert an element at the given position, moving the element 
 80     * currently located in that position, and all elements in higher
 81     * position, up by one.
 82     *
 83     * @param element The element to insert
 84     * @param index   The position in the array:
 85     *                If the position is lower than the current length
 86     *                of the array, the elements at that position and
 87     *                onwards are bumped one position up.
 88     *                If the position is equal to the current length
 89     *                of the array, the new element is appended.
 90     *                An index lower than 0 or higher than the current
 91     *                length of the array is invalid and will be ignored.
 92     *
 93     * @throws NS_ERROR_FAILURE when a weak reference is requested,
 94     *                          but the element does not support
 95     *                          nsIWeakReference.
 96     */
 97  /* void insertElementAt (in nsISupports element, in unsigned long index, in boolean weak); */
 98  NS_SCRIPTABLE NS_IMETHOD InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak) = 0;
 99
100  /**
101     * replaceElementAt()
102     *
103     * Replace the element at the given position.
104     *
105     * @param element The new element to insert
106     * @param index   The position in the array
107     *                If the position is lower than the current length
108     *                of the array, an existing element will be replaced.
109     *                If the position is equal to the current length
110     *                of the array, the new element is appended.
111     *                If the position is higher than the current length
112     *                of the array, empty elements are appended followed
113     *                by the new element at the specified position.
114     *                An index lower than 0 is invalid and will be ignored.
115     *
116     * @param weak    Whether or not to store the new element using a weak
117     *                reference.
118     *
119     * @throws NS_ERROR_FAILURE when a weak reference is requested,
120     *                          but the element does not support
121     *                          nsIWeakReference.
122     */
123  /* void replaceElementAt (in nsISupports element, in unsigned long index, in boolean weak); */
124  NS_SCRIPTABLE NS_IMETHOD ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak) = 0;
125
126  /**
127     * clear()
128     *
129     * clear the entire array, releasing all stored objects
130     */
131  /* void clear (); */
132  NS_SCRIPTABLE NS_IMETHOD Clear(void) = 0;
133
134};
135
136  NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutableArray, NS_IMUTABLEARRAY_IID)
137
138/* Use this macro when declaring classes that implement this interface. */
139#define NS_DECL_NSIMUTABLEARRAY \
140  NS_SCRIPTABLE NS_IMETHOD AppendElement(nsISupports *element, PRBool weak); \
141  NS_SCRIPTABLE NS_IMETHOD RemoveElementAt(PRUint32 index); \
142  NS_SCRIPTABLE NS_IMETHOD InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak); \
143  NS_SCRIPTABLE NS_IMETHOD ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak); \
144  NS_SCRIPTABLE NS_IMETHOD Clear(void); 
145
146/* Use this macro to declare functions that forward the behavior of this interface to another object. */
147#define NS_FORWARD_NSIMUTABLEARRAY(_to) \
148  NS_SCRIPTABLE NS_IMETHOD AppendElement(nsISupports *element, PRBool weak) { return _to AppendElement(element, weak); } \
149  NS_SCRIPTABLE NS_IMETHOD RemoveElementAt(PRUint32 index) { return _to RemoveElementAt(index); } \
150  NS_SCRIPTABLE NS_IMETHOD InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak) { return _to InsertElementAt(element, index, weak); } \
151  NS_SCRIPTABLE NS_IMETHOD ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak) { return _to ReplaceElementAt(element, index, weak); } \
152  NS_SCRIPTABLE NS_IMETHOD Clear(void) { return _to Clear(); } 
153
154/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
155#define NS_FORWARD_SAFE_NSIMUTABLEARRAY(_to) \
156  NS_SCRIPTABLE NS_IMETHOD AppendElement(nsISupports *element, PRBool weak) { return !_to ? NS_ERROR_NULL_POINTER : _to->AppendElement(element, weak); } \
157  NS_SCRIPTABLE NS_IMETHOD RemoveElementAt(PRUint32 index) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveElementAt(index); } \
158  NS_SCRIPTABLE NS_IMETHOD InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak) { return !_to ? NS_ERROR_NULL_POINTER : _to->InsertElementAt(element, index, weak); } \
159  NS_SCRIPTABLE NS_IMETHOD ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReplaceElementAt(element, index, weak); } \
160  NS_SCRIPTABLE NS_IMETHOD Clear(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Clear(); } 
161
162#if 0
163/* Use the code below as a template for the implementation class for this interface. */
164
165/* Header file */
166class nsMutableArray : public nsIMutableArray
167{
168public:
169  NS_DECL_ISUPPORTS
170  NS_DECL_NSIMUTABLEARRAY
171
172  nsMutableArray();
173
174private:
175  ~nsMutableArray();
176
177protected:
178  /* additional members */
179};
180
181/* Implementation file */
182NS_IMPL_ISUPPORTS1(nsMutableArray, nsIMutableArray)
183
184nsMutableArray::nsMutableArray()
185{
186  /* member initializers and constructor code */
187}
188
189nsMutableArray::~nsMutableArray()
190{
191  /* destructor code */
192}
193
194/* void appendElement (in nsISupports element, in boolean weak); */
195NS_IMETHODIMP nsMutableArray::AppendElement(nsISupports *element, PRBool weak)
196{
197    return NS_ERROR_NOT_IMPLEMENTED;
198}
199
200/* void removeElementAt (in unsigned long index); */
201NS_IMETHODIMP nsMutableArray::RemoveElementAt(PRUint32 index)
202{
203    return NS_ERROR_NOT_IMPLEMENTED;
204}
205
206/* void insertElementAt (in nsISupports element, in unsigned long index, in boolean weak); */
207NS_IMETHODIMP nsMutableArray::InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak)
208{
209    return NS_ERROR_NOT_IMPLEMENTED;
210}
211
212/* void replaceElementAt (in nsISupports element, in unsigned long index, in boolean weak); */
213NS_IMETHODIMP nsMutableArray::ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak)
214{
215    return NS_ERROR_NOT_IMPLEMENTED;
216}
217
218/* void clear (); */
219NS_IMETHODIMP nsMutableArray::Clear()
220{
221    return NS_ERROR_NOT_IMPLEMENTED;
222}
223
224/* End of implementation class template. */
225#endif
226
227
228#endif /* __gen_nsIMutableArray_h__ */