PageRenderTime 511ms CodeModel.GetById 499ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_sdk/idl/nsIMutableArray.idl

http://firefox-mac-pdf.googlecode.com/
IDL | 145 lines | 12 code | 7 blank | 126 comment | 0 complexity | e5979de3bac9c2e6ccbc1f4305306624 MD5 | raw file
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is XPCOM Array interface.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corp.
  19. * Portions created by the Initial Developer are Copyright (C) 2002
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. * Alec Flett <alecf@netscape.com>
  24. *
  25. * Alternatively, the contents of this file may be used under the terms of
  26. * either the GNU General Public License Version 2 or later (the "GPL"), or
  27. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. * in which case the provisions of the GPL or the LGPL are applicable instead
  29. * of those above. If you wish to allow use of your version of this file only
  30. * under the terms of either the GPL or the LGPL, and not to allow others to
  31. * use your version of this file under the terms of the MPL, indicate your
  32. * decision by deleting the provisions above and replace them with the notice
  33. * and other provisions required by the GPL or the LGPL. If you do not delete
  34. * the provisions above, a recipient may use your version of this file under
  35. * the terms of any one of the MPL, the GPL or the LGPL.
  36. *
  37. * ***** END LICENSE BLOCK ***** */
  38. #include "nsIArray.idl"
  39. /**
  40. * nsIMutableArray
  41. * A separate set of methods that will act on the array. Consumers of
  42. * nsIArray should not QueryInterface to nsIMutableArray unless they
  43. * own the array.
  44. *
  45. * As above, it is legal to add null elements to the array. Note also
  46. * that null elements can be created as a side effect of
  47. * insertElementAt(). Conversely, if insertElementAt() is never used,
  48. * and null elements are never explicitly added to the array, then it
  49. * is guaranteed that queryElementAt() will never return a null value.
  50. *
  51. * Any of these methods may throw NS_ERROR_OUT_OF_MEMORY when the
  52. * array must grow to complete the call, but the allocation fails.
  53. *
  54. * @status FROZEN
  55. */
  56. [scriptable, uuid(af059da0-c85b-40ec-af07-ae4bfdc192cc)]
  57. interface nsIMutableArray : nsIArray
  58. {
  59. /**
  60. * appendElement()
  61. *
  62. * Append an element at the end of the array.
  63. *
  64. * @param element The element to append.
  65. * @param weak Whether or not to store the element using a weak
  66. * reference.
  67. * @throws NS_ERROR_FAILURE when a weak reference is requested,
  68. * but the element does not support
  69. * nsIWeakReference.
  70. */
  71. void appendElement(in nsISupports element, in boolean weak);
  72. /**
  73. * removeElementAt()
  74. *
  75. * Remove an element at a specific position, moving all elements
  76. * stored at a higher position down one.
  77. * To remove a specific element, use indexOf() to find the index
  78. * first, then call removeElementAt().
  79. *
  80. * @param index the position of the item
  81. *
  82. */
  83. void removeElementAt(in unsigned long index);
  84. /**
  85. * insertElementAt()
  86. *
  87. * Insert an element at the given position, moving the element
  88. * currently located in that position, and all elements in higher
  89. * position, up by one.
  90. *
  91. * @param element The element to insert
  92. * @param index The position in the array:
  93. * If the position is lower than the current length
  94. * of the array, the elements at that position and
  95. * onwards are bumped one position up.
  96. * If the position is equal to the current length
  97. * of the array, the new element is appended.
  98. * An index lower than 0 or higher than the current
  99. * length of the array is invalid and will be ignored.
  100. *
  101. * @throws NS_ERROR_FAILURE when a weak reference is requested,
  102. * but the element does not support
  103. * nsIWeakReference.
  104. */
  105. void insertElementAt(in nsISupports element, in unsigned long index,
  106. in boolean weak);
  107. /**
  108. * replaceElementAt()
  109. *
  110. * Replace the element at the given position.
  111. *
  112. * @param element The new element to insert
  113. * @param index The position in the array
  114. * If the position is lower than the current length
  115. * of the array, an existing element will be replaced.
  116. * If the position is equal to the current length
  117. * of the array, the new element is appended.
  118. * If the position is higher than the current length
  119. * of the array, empty elements are appended followed
  120. * by the new element at the specified position.
  121. * An index lower than 0 is invalid and will be ignored.
  122. *
  123. * @param weak Whether or not to store the new element using a weak
  124. * reference.
  125. *
  126. * @throws NS_ERROR_FAILURE when a weak reference is requested,
  127. * but the element does not support
  128. * nsIWeakReference.
  129. */
  130. void replaceElementAt(in nsISupports element, in unsigned long index,
  131. in boolean weak);
  132. /**
  133. * clear()
  134. *
  135. * clear the entire array, releasing all stored objects
  136. */
  137. void clear();
  138. };