withDictionary
Creates and initializes an OSDictionary populated with the contents of another dictionary.
Declaration
static OSDictionary * withDictionary(
const OSDictionary *dict,
unsigned int capacity = 0);Parameters
- dict:
A dictionary whose contents will be stored in the new instance.
- capacity:
The initial storage capacity of the new dictionary object. If 0, the capacity is set to the number of key/value pairs in
dict; otherwisecapacitymust be greater than or equal to the number of key/value pairs indict.
Return Value
An instance of OSDictionary containing the key/value pairs of dict, with a retain count of 1; NULL on failure.
Overview
dict must be non-NULL. If capacity is nonzero, it must be greater than or equal to count. The new dictionary will grow as needed to accommodate more key/object pairs (unlikeCFMutableDictionary, for which the initial capacity is a hard limit).
The keys and objects in dict are retained for storage in the new OSDictionary, not copied.
See Also
Miscellaneous
copyCollectionensureCapacityflushCollectionfreegetCapacitygetCapacityIncrementgetCountgetObjectgetObject(const OSString *)getObject(const OSSymbol *)initWithCapacityinitWithDictionaryinitWithObjects(const OSObject *, const OSString *, unsigned int, unsigned int)initWithObjects(const OSObject *, const OSSymbol *, unsigned int, unsigned int)isEqualToisEqualTo(const OSDictionary *)isEqualTo(const OSDictionary *, const OSCollection *)mergeremoveObjectremoveObject(const OSString *)removeObject(const OSSymbol *)serializesetCapacityIncrementsetObjectsetObject(const OSString *, const OSMetaClassBase *)setObject(const OSSymbol *, const OSMetaClassBase *)withCapacitywithObjects(const OSObject *, const OSString *, unsigned int, unsigned int)withObjects(const OSObject *, const OSSymbol *, unsigned int, unsigned int)