PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/gecko_sdk/idl/nsIArray.idl

http://firefox-mac-pdf.googlecode.com/
IDL | 126 lines | 13 code | 6 blank | 107 comment | 0 complexity | 4c756c64b121b57e274b366c140b9dfc 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 "nsISupports.idl"
  39. interface nsISimpleEnumerator;
  40. /**
  41. * nsIArray
  42. *
  43. * An indexed collection of elements. Provides basic functionality for
  44. * retrieving elements at a specific position, searching for
  45. * elements. Indexes are zero-based, such that the last element in the
  46. * array is stored at the index length-1.
  47. *
  48. * For an array which can be modified, see nsIMutableArray below.
  49. *
  50. * Neither interface makes any attempt to protect the individual
  51. * elements from modification. The convention is that the elements of
  52. * the array should not be modified. Documentation within a specific
  53. * interface should describe variations from this convention.
  54. *
  55. * It is also convention that if an interface provides access to an
  56. * nsIArray, that the array should not be QueryInterfaced to an
  57. * nsIMutableArray for modification. If the interface in question had
  58. * intended the array to be modified, it would have returned an
  59. * nsIMutableArray!
  60. *
  61. * null is a valid entry in the array, and as such any nsISupports
  62. * parameters may be null, except where noted.
  63. *
  64. * @status FROZEN
  65. */
  66. [scriptable, uuid(114744d9-c369-456e-b55a-52fe52880d2d)]
  67. interface nsIArray : nsISupports
  68. {
  69. /**
  70. * length
  71. *
  72. * number of elements in the array.
  73. */
  74. readonly attribute unsigned long length;
  75. /**
  76. * queryElementAt()
  77. *
  78. * Retrieve a specific element of the array, and QueryInterface it
  79. * to the specified interface. null is a valid result for
  80. * this method, but exceptions are thrown in other circumstances
  81. *
  82. * @param index position of element
  83. * @param uuid the IID of the requested interface
  84. * @param result the object, QI'd to the requested interface
  85. *
  86. * @throws NS_ERROR_NO_INTERFACE when an entry exists at the
  87. * specified index, but the requested interface is not
  88. * available.
  89. * @throws NS_ERROR_ILLEGAL_VALUE when index > length-1
  90. *
  91. */
  92. void queryElementAt(in unsigned long index,
  93. in nsIIDRef uuid,
  94. [iid_is(uuid), retval] out nsQIResult result);
  95. /**
  96. * indexOf()
  97. *
  98. * Get the position of a specific element. Note that since null is
  99. * a valid input, exceptions are used to indicate that an element
  100. * is not found.
  101. *
  102. * @param startIndex The initial element to search in the array
  103. * To start at the beginning, use 0 as the
  104. * startIndex
  105. * @param element The element you are looking for
  106. * @returns a number >= startIndex which is the position of the
  107. * element in the array.
  108. * @throws NS_ERROR_NOT_FOUND if the element was not in the array.
  109. */
  110. unsigned long indexOf(in unsigned long startIndex,
  111. in nsISupports element);
  112. /**
  113. * enumerate the array
  114. *
  115. * @returns a new enumerator positioned at the start of the array
  116. * @throws NS_ERROR_FAILURE if the array is empty (to make it easy
  117. * to detect errors)
  118. */
  119. nsISimpleEnumerator enumerate();
  120. };