nsIDictionary 编辑

extensions/xml-rpc/idl/nsIDictionary.idlScriptable A simple mutable table of objects, maintained as key/value pairs. Objects can be located and managed by referencing them by key. 66 Introduced Gecko 1.0 Obsolete Gecko 1.9.1 Inherits from: nsISummary Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Note: This interface was removed in Firefox 3.5; use Dict.jsm instead. See bug 668424 for further information.

Method overview

boolean hasKey(in string key);
void getKeys(out PRUint32 count, [retval, array, size_is(count)] out string keys);
nsISupports getValue(in string key);
void setValue(in string key, in nsISupports value);
nsISupports deleteValue(in string key);
void clear();

Methods

hasKey()

Check if a given key is present in the dictionary.

  boolean hasKey(
     in string key
  );
Parameters
key
Key to check for.
Return value

true if present, false if absent.

getKeys()

Retrieve all keys in the dictionary.

  void getKeys(
     out PRUint32 count,
     [retval, array, size_is(count)] out string keys
  );
Return value

Array of all keys, unsorted.

getValue()

Find the value indicated by the key.

  nsISupports getValue(
     in string key
  );
Parameters
key
The lookup key indicating the value.
Return value

The value associated with the specified key. If the key doesn't exist, NS_ERROR_FAILURE is returned.

setValue()

Add the key-value pair to the dictionary. If the key is already present, the new value replaces the old one.

  void setValue(
     in string key,
     in nsISupports value
  );
Parameters
key
The key by which the value can be accessed.
value
The value to store.

deleteValue()

Find the value indicated by the key.

  nsISupports deleteValue(
     in string key
  );
Parameters
key
The key indicating the pair to be removed.
Return value

The removed value. If the key doesn't exist, NS_ERROR_FAILURE will be returned.

clear()

Delete all key-value pairs from the dictionary.

  void clear();
Parameters

None.

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

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

发布评论

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

词条统计

浏览:82 次

字数:4948

最后编辑:6 年前

编辑次数:0 次

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