nsIDictionary:

 A simple mutable table of objects, maintained as key/value pairs. Objects can be located and managed by referencing them by key.

Please add a summary to this article.
  Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Note: As per https://bugzilla.mozilla.org/show_bug.cgi?id=668424, this interface is no longer available in Firefox.  Use Dict.jsm instead.

Inherits from: nsISupports

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
 Last updated by: Sheppy,