nsIDictionary 编辑
extensions/xml-rpc/idl/nsIDictionary.idl
Scriptable 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论