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
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/
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
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
39 #include
"nsISupports.idl"
40 #include
"nsICollection.idl"
43 * This entire interface is deprecated and should not be used.
44 * See nsIArray and nsIMutableArray for the new implementations.
46 * http://groups.google.com/groups?q=nsisupportsarray+group:netscape.public.mozilla.xpcom&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3D779491.3050506%40netscape.com&rnum=2
47 * http://groups.google.com/groups?q=nsisupportsarray+group:netscape.public.mozilla.xpcom&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=al8412%245ab2%40ripley.netscape.com&rnum=8
50 native nsISupportsArrayEnumFunc
(nsISupportsArrayEnumFunc
);
54 class nsIBidirectionalEnumerator
;
55 class nsISupportsArray
;
57 #define NS_SUPPORTSARRAY_CID \
58 { /* bda17d50-0d6b-11d3-9331-00104ba0fd40 */ \
62 {0x93, 0x31, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
64 #define NS_SUPPORTSARRAY_CONTRACTID
"@mozilla.org/supports-array;1"
65 #define NS_SUPPORTSARRAY_CLASSNAME
"Supports Array"
67 // Enumerator callback function. Return PR_FALSE to stop
68 typedef PRBool
(*nsISupportsArrayEnumFunc
)(nsISupports
* aElement
, void *aData
);
71 NS_NewArrayEnumerator
(nsISimpleEnumerator
* *result
,
72 nsISupportsArray
* array
);
75 [scriptable
, uuid(791eafa0
-b9e6
-11d1
-8031-006008159b5a
)]
76 interface nsISupportsArray
: nsICollection
{
78 [notxpcom
] boolean Equals
([const] in nsISupportsArray other
);
80 [notxpcom
] nsISupports ElementAt
(in unsigned long aIndex
);
82 [notxpcom
] long IndexOf
([const] in nsISupports aPossibleElement
);
83 [notxpcom
] long IndexOfStartingAt
([const] in nsISupports aPossibleElement
,
84 in unsigned long aStartIndex
);
85 [notxpcom
] long LastIndexOf
([const] in nsISupports aPossibleElement
);
87 // xpcom-compatible versions
88 long GetIndexOf
(in nsISupports aPossibleElement
);
89 long GetIndexOfStartingAt
(in nsISupports aPossibleElement
,
90 in unsigned long aStartIndex
);
91 long GetLastIndexOf
(in nsISupports aPossibleElement
);
93 [notxpcom
] boolean InsertElementAt
(in nsISupports aElement
,
94 in unsigned long aIndex
);
95 [notxpcom
] boolean ReplaceElementAt
(in nsISupports aElement
,
96 in unsigned long aIndex
);
98 [notxpcom
] boolean RemoveElementAt
(in unsigned long aIndex
);
99 [notxpcom
] boolean RemoveLastElement
([const] in nsISupports aElement
);
101 // xpcom-compatible versions
102 void DeleteLastElement
(in nsISupports aElement
);
103 void DeleteElementAt
(in unsigned long aIndex
);
105 [notxpcom
] boolean AppendElements
(in nsISupportsArray aElements
);
110 boolean EnumerateForwards
(in nsISupportsArrayEnumFunc aFunc
,
113 boolean EnumerateBackwards
(in nsISupportsArrayEnumFunc aFunc
,
116 nsISupportsArray clone
();
118 [notxpcom
] boolean MoveElement
(in long aFrom
,
121 [notxpcom
] boolean InsertElementsAt
(in nsISupportsArray aOther
,
122 in unsigned long aIndex
);
124 [notxpcom
] boolean RemoveElementsAt
(in unsigned long aIndex
,
125 in unsigned long aCount
);
127 [notxpcom
] boolean SizeTo
(in long aSize
);
133 // Construct and return a default implementation of nsISupportsArray:
134 extern NS_COM nsresult
135 NS_NewISupportsArray
(nsISupportsArray
** aInstancePtrResult
);
137 // Construct and return a default implementation of an enumerator for nsISupportsArrays:
138 extern NS_COM nsresult
139 NS_NewISupportsArrayEnumerator
(nsISupportsArray
* array
,
140 nsIBidirectionalEnumerator
* *aInstancePtrResult
);