Contents

setObject

Add or replace an object in the dictionary.

Declaration

bool setObject(const OSObject *aKey, const OSMetaClassBase *anObject);

Parameters

  • aKey:

    An object pointer used to lookup the object. The key should be uniqued within the dictionary. Usually an OSString is passed as the key.

  • anObject:

    Object to be added to the dictionary.

Return Value

True on success, which retains the object, or false on failure which does not retain the object.

Discussion

The object is added to the dictionary with the key object. If an object with the given key existed prior to the call it is replaced and released. The dictionary capacity will be grown if necessary.

See Also

Accessing Keys and Values