1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
8 #include
"nsICollection.idl"
11 * This entire interface is deprecated and should not be used.
12 * See nsIArray and nsIMutableArray for the new implementations.
14 * 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
15 * 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
18 native nsISupportsArrayEnumFunc
(nsISupportsArrayEnumFunc
);
22 class nsIBidirectionalEnumerator
;
23 class nsISupportsArray
;
25 #define NS_SUPPORTSARRAY_CID \
26 { /* bda17d50-0d6b-11d3-9331-00104ba0fd40 */ \
30 {0x93, 0x31, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
32 #define NS_SUPPORTSARRAY_CONTRACTID
"@mozilla.org/supports-array;1"
33 #define NS_SUPPORTSARRAY_CLASSNAME
"Supports Array"
35 // Enumerator callback function. Return PR_FALSE to stop
36 typedef bool
(*nsISupportsArrayEnumFunc
)(nsISupports
* aElement
, void *aData
);
39 NS_NewArrayEnumerator
(nsISimpleEnumerator
* *result
,
40 nsISupportsArray
* array
);
43 [scriptable
, uuid(791eafa0
-b9e6
-11d1
-8031-006008159b5a
)]
44 interface nsISupportsArray
: nsICollection
{
46 [notxpcom
] boolean Equals
([const] in nsISupportsArray other
);
48 [notxpcom
] nsISupports ElementAt
(in unsigned long aIndex
);
50 [notxpcom
] long IndexOf
([const] in nsISupports aPossibleElement
);
51 [notxpcom
] long IndexOfStartingAt
([const] in nsISupports aPossibleElement
,
52 in unsigned long aStartIndex
);
53 [notxpcom
] long LastIndexOf
([const] in nsISupports aPossibleElement
);
55 // xpcom-compatible versions
56 long GetIndexOf
(in nsISupports aPossibleElement
);
57 long GetIndexOfStartingAt
(in nsISupports aPossibleElement
,
58 in unsigned long aStartIndex
);
59 long GetLastIndexOf
(in nsISupports aPossibleElement
);
61 [notxpcom
] boolean InsertElementAt
(in nsISupports aElement
,
62 in unsigned long aIndex
);
63 [notxpcom
] boolean ReplaceElementAt
(in nsISupports aElement
,
64 in unsigned long aIndex
);
66 [notxpcom
] boolean RemoveElementAt
(in unsigned long aIndex
);
67 [notxpcom
] boolean RemoveLastElement
([const] in nsISupports aElement
);
69 // xpcom-compatible versions
70 void DeleteLastElement
(in nsISupports aElement
);
71 void DeleteElementAt
(in unsigned long aIndex
);
73 [notxpcom
] boolean AppendElements
(in nsISupportsArray aElements
);
78 boolean EnumerateForwards
(in nsISupportsArrayEnumFunc aFunc
,
81 boolean EnumerateBackwards
(in nsISupportsArrayEnumFunc aFunc
,
84 nsISupportsArray clone
();
86 [notxpcom
] boolean MoveElement
(in long aFrom
,
89 [notxpcom
] boolean InsertElementsAt
(in nsISupportsArray aOther
,
90 in unsigned long aIndex
);
92 [notxpcom
] boolean RemoveElementsAt
(in unsigned long aIndex
,
93 in unsigned long aCount
);
95 [notxpcom
] boolean SizeTo
(in long aSize
);
101 // Construct and return a default implementation of nsISupportsArray:
103 NS_NewISupportsArray
(nsISupportsArray
** aInstancePtrResult
);
105 // Construct and return a default implementation of an enumerator for nsISupportsArrays:
107 NS_NewISupportsArrayEnumerator
(nsISupportsArray
* array
,
108 nsIBidirectionalEnumerator
* *aInstancePtrResult
);