Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIDictionary

A simple mutable table of objects, maintained as key/value pairs. Objects can be located and managed by referencing them by key.
28
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.

Document Tags and Contributors

 Contributors to this page: Sheppy, vbguyny, Kglee
 Last updated by: Sheppy,