nsICollection

This interface represents a list of nsISupports items. It provides basic operations on those items like: getting, setting, appending, removing, and so on.
Inherits from: nsISerializable Last changed in Gecko 1.7

Method overview

void AppendElement(in nsISupports item);
void Clear();
PRUint32 Count();
nsIEnumerator Enumerate();
nsISupports GetElementAt(in PRUint32 index);
void QueryElementAt(in PRUint32 index, in nsIIDRef uuid, [iid_is(uuid),retval] out nsQIResult result);
void RemoveElement(in nsISupports item);
void SetElementAt(in PRUint32 index, in nsISupports item);

Methods

AppendElement()

Appends a new item to the collection.

void AppendElement(
  in nsISupports item
)
Parameters
item
nsISupports item to be appended to the list.

Clear()

Removes all items from the collection.

void Clear();
Parameters

None.

Count()

Returns the number of items in the collection.

PRUint32 Count();
Parameters

None.

Return value

Number of items in the list.

Enumerate()

Returns an nsIEnumerator that lets you iterate over the items in the collection.

nsIEnumerator Enumerate();
Parameters

None.

Return value

An nsIEnumerator.

GetElementAt()

Returns the element at the specified index into the collection.

nsISupports GetElementAt(
  in PRUint32 index
);
Parameters
index
The index position of the item to be returned.
Return value

nsISupports item at the index position.

QueryElementAt()

Performs a QueryInterface on the item at the specified index into the collection.

void QueryElementAt(
  in PRUint32 index,
  in nsIIDRef uuid,
  [iid_is(uuid),retval] out nsQIResult result
);
Parameters
index
Position of the item to be queried.
uuid
nsIIDRef of the item.
result
Comparison result of the previous two parameters.

RemoveElement()

Removes an item from the collection.

void RemoveElement(
  in nsISupports item
);
Parameters
item
nsISupports item to be removed from the list.

SetElementAt()

Replaces an item at a specified index in the collection with a new one.

void SetElementAt(
  in PRUint32 index,
  in nsISupports item
);
Parameters
index
Index position where the new item will be set.
item
The nsISupports item to be set in that position.

Remarks

nsIEnumerator is a broken interface, and nsISimpleEnumerator should be used in its place.

See also