PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/gecko_api/include/nsIArray.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 199 lines | 73 code | 33 blank | 93 comment | 0 complexity | 745f7f7a4e09eb453d28f1af690b4ab8 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/nsIArray.idl
  3 */
  4
  5#ifndef __gen_nsIArray_h__
  6#define __gen_nsIArray_h__
  7
  8
  9#ifndef __gen_nsISupports_h__
 10#include "nsISupports.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
 17class nsISimpleEnumerator; /* forward declaration */
 18
 19
 20/* starting interface:    nsIArray */
 21#define NS_IARRAY_IID_STR "114744d9-c369-456e-b55a-52fe52880d2d"
 22
 23#define NS_IARRAY_IID \
 24  {0x114744d9, 0xc369, 0x456e, \
 25    { 0xb5, 0x5a, 0x52, 0xfe, 0x52, 0x88, 0x0d, 0x2d }}
 26
 27/**
 28 * nsIArray
 29 *
 30 * An indexed collection of elements. Provides basic functionality for
 31 * retrieving elements at a specific position, searching for
 32 * elements. Indexes are zero-based, such that the last element in the
 33 * array is stored at the index length-1.
 34 *
 35 * For an array which can be modified, see nsIMutableArray below.
 36 *
 37 * Neither interface makes any attempt to protect the individual
 38 * elements from modification. The convention is that the elements of
 39 * the array should not be modified. Documentation within a specific
 40 * interface should describe variations from this convention.
 41 *
 42 * It is also convention that if an interface provides access to an
 43 * nsIArray, that the array should not be QueryInterfaced to an
 44 * nsIMutableArray for modification. If the interface in question had
 45 * intended the array to be modified, it would have returned an
 46 * nsIMutableArray!
 47 *
 48 * null is a valid entry in the array, and as such any nsISupports
 49 * parameters may be null, except where noted.
 50 *
 51 * @status FROZEN
 52 */
 53class NS_NO_VTABLE NS_SCRIPTABLE nsIArray : public nsISupports {
 54 public: 
 55
 56  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IARRAY_IID)
 57
 58  /**
 59     * length
 60     *
 61     * number of elements in the array.
 62     */
 63  /* readonly attribute unsigned long length; */
 64  NS_SCRIPTABLE NS_IMETHOD GetLength(PRUint32 *aLength) = 0;
 65
 66  /**
 67     * queryElementAt()
 68     *
 69     * Retrieve a specific element of the array, and QueryInterface it
 70     * to the specified interface. null is a valid result for
 71     * this method, but exceptions are thrown in other circumstances
 72     * 
 73     * @param index position of element
 74     * @param uuid the IID of the requested interface
 75     * @param result the object, QI'd to the requested interface
 76     *
 77     * @throws NS_ERROR_NO_INTERFACE when an entry exists at the
 78     *         specified index, but the requested interface is not
 79     *         available.
 80     * @throws NS_ERROR_ILLEGAL_VALUE when index > length-1
 81     *
 82     */
 83  /* void queryElementAt (in unsigned long index, in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
 84  NS_SCRIPTABLE NS_IMETHOD QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result) = 0;
 85
 86  /**
 87     * indexOf()
 88     * 
 89     * Get the position of a specific element. Note that since null is
 90     * a valid input, exceptions are used to indicate that an element
 91     * is not found.
 92     * 
 93     * @param startIndex The initial element to search in the array
 94     *                   To start at the beginning, use 0 as the
 95     *                   startIndex
 96     * @param element    The element you are looking for
 97     * @returns a number >= startIndex which is the position of the
 98     *          element in the array.
 99     * @throws NS_ERROR_NOT_FOUND if the element was not in the array.
100     */
101  /* unsigned long indexOf (in unsigned long startIndex, in nsISupports element); */
102  NS_SCRIPTABLE NS_IMETHOD IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval) = 0;
103
104  /**
105     * enumerate the array
106     *
107     * @returns a new enumerator positioned at the start of the array
108     * @throws NS_ERROR_FAILURE if the array is empty (to make it easy
109     *         to detect errors)
110     */
111  /* nsISimpleEnumerator enumerate (); */
112  NS_SCRIPTABLE NS_IMETHOD Enumerate(nsISimpleEnumerator **_retval) = 0;
113
114};
115
116  NS_DEFINE_STATIC_IID_ACCESSOR(nsIArray, NS_IARRAY_IID)
117
118/* Use this macro when declaring classes that implement this interface. */
119#define NS_DECL_NSIARRAY \
120  NS_SCRIPTABLE NS_IMETHOD GetLength(PRUint32 *aLength); \
121  NS_SCRIPTABLE NS_IMETHOD QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result); \
122  NS_SCRIPTABLE NS_IMETHOD IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval); \
123  NS_SCRIPTABLE NS_IMETHOD Enumerate(nsISimpleEnumerator **_retval); 
124
125/* Use this macro to declare functions that forward the behavior of this interface to another object. */
126#define NS_FORWARD_NSIARRAY(_to) \
127  NS_SCRIPTABLE NS_IMETHOD GetLength(PRUint32 *aLength) { return _to GetLength(aLength); } \
128  NS_SCRIPTABLE NS_IMETHOD QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result) { return _to QueryElementAt(index, uuid, result); } \
129  NS_SCRIPTABLE NS_IMETHOD IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval) { return _to IndexOf(startIndex, element, _retval); } \
130  NS_SCRIPTABLE NS_IMETHOD Enumerate(nsISimpleEnumerator **_retval) { return _to Enumerate(_retval); } 
131
132/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
133#define NS_FORWARD_SAFE_NSIARRAY(_to) \
134  NS_SCRIPTABLE NS_IMETHOD GetLength(PRUint32 *aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLength(aLength); } \
135  NS_SCRIPTABLE NS_IMETHOD QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->QueryElementAt(index, uuid, result); } \
136  NS_SCRIPTABLE NS_IMETHOD IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IndexOf(startIndex, element, _retval); } \
137  NS_SCRIPTABLE NS_IMETHOD Enumerate(nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Enumerate(_retval); } 
138
139#if 0
140/* Use the code below as a template for the implementation class for this interface. */
141
142/* Header file */
143class nsArray : public nsIArray
144{
145public:
146  NS_DECL_ISUPPORTS
147  NS_DECL_NSIARRAY
148
149  nsArray();
150
151private:
152  ~nsArray();
153
154protected:
155  /* additional members */
156};
157
158/* Implementation file */
159NS_IMPL_ISUPPORTS1(nsArray, nsIArray)
160
161nsArray::nsArray()
162{
163  /* member initializers and constructor code */
164}
165
166nsArray::~nsArray()
167{
168  /* destructor code */
169}
170
171/* readonly attribute unsigned long length; */
172NS_IMETHODIMP nsArray::GetLength(PRUint32 *aLength)
173{
174    return NS_ERROR_NOT_IMPLEMENTED;
175}
176
177/* void queryElementAt (in unsigned long index, in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
178NS_IMETHODIMP nsArray::QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result)
179{
180    return NS_ERROR_NOT_IMPLEMENTED;
181}
182
183/* unsigned long indexOf (in unsigned long startIndex, in nsISupports element); */
184NS_IMETHODIMP nsArray::IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval)
185{
186    return NS_ERROR_NOT_IMPLEMENTED;
187}
188
189/* nsISimpleEnumerator enumerate (); */
190NS_IMETHODIMP nsArray::Enumerate(nsISimpleEnumerator **_retval)
191{
192    return NS_ERROR_NOT_IMPLEMENTED;
193}
194
195/* End of implementation class template. */
196#endif
197
198
199#endif /* __gen_nsIArray_h__ */