nsICollection 编辑

xpcom/ds/nsICollection.idlScriptable 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:51 次

字数:6889

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文