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