Function

CFSetGetValueIfPresent

Reports whether or not a value is in a set, and if it exists returns the value indirectly.

Declaration

Boolean CFSetGetValueIfPresent(CFSetRef theSet, const void *candidate, const void **value);

Parameters

theSet

The set to examine.

candidate

The value for which to search in theSet. Comparisons are made using the equal callback provided when theSet was created. If the equal callback was NULL, pointer equality (in C, ==) is used.

value

Upon return contains the matching value if it exists in theSet, otherwise NULL. If the value is a Core Foundation object, ownership follows the The Get Rule.

Return Value

true if value exists in theSet, otherwise false.

Discussion

This function uses the equal callback. candidate and all elements in the set must be understood by the equal callback. Depending on the implementation of the equal callback specified when creating theSet, the value returned in value may not have the same pointer equality as candidate.

See Also

Examining a Set

CFSetContainsValue

Returns a Boolean that indicates whether a set contains a given value.

CFSetGetCount

Returns the number of values currently in a set.

CFSetGetCountOfValue

Returns the number of values in a set that match a given value.

CFSetGetValue

Obtains a specified value from a set.

CFSetGetValues

Obtains all values in a set.