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