Function

CFDictionaryGetValue

Returns the value associated with a given key.

Declaration

const void * CFDictionaryGetValue(CFDictionaryRef theDict, const void *key);

Parameters

theDict

The dictionary to examine.

key

The key for which to find a match in theDict. The key hash and equal callbacks provided when the dictionary was created are used to compare. If the hash callback was NULL, the key is treated as a pointer and converted to an integer. If the equal callback was NULL, pointer equality (in C, ==) is used. If key, or any of the keys in theDict, is not understood by the equal callback, the behavior is undefined.

Return Value

The value associated with key in theDict, or NULL if no key-value pair matching key exists. Since NULL is also a valid value in some dictionaries, use CFDictionaryGetValueIfPresent to distinguish between a value that is not found, and a NULL value. If the value is a Core Foundation object, ownership follows the The Get Rule.

See Also

Examining a dictionary

CFDictionaryContainsKey

Returns a Boolean value that indicates whether a given key is in a dictionary.

CFDictionaryContainsValue

Returns a Boolean value that indicates whether a given value is in a dictionary.

CFDictionaryGetCount

Returns the number of key-value pairs in a dictionary.

CFDictionaryGetCountOfKey

Returns the number of times a key occurs in a dictionary.

CFDictionaryGetCountOfValue

Counts the number of times a given value occurs in the dictionary.

CFDictionaryGetKeysAndValues

Fills two buffers with the keys and values from a dictionary.

CFDictionaryGetValueIfPresent

Returns a Boolean value that indicates whether a given value for a given key is in a dictionary, and returns that value indirectly if it exists.