OSDictionary
Member Functions
Abstract: Member function to grow the size of the collection.
public:
virtual unsigned int ensureCapacity(unsigned int newCapacity);
Parameters
Name | Description |
newCapacity | The new capacity for the dictionary to expand to. |
Result: Returns the new capacity of the dictionary or the previous capacity upon error.
Abstract: A member function which removes and releases all objects within the collection.
public:
virtual void flushCollection();
Abstract: A member functions to deallocate and release all resources used by the OSDictionary instance.
public:
virtual void free();
This function should not be called directly, use release() instead.
Abstract: A member function which returns the storage capacity of the collection.
public:
virtual unsigned int getCapacity() const;
Result: Returns the storage capacity of the dictionary.
Abstract: A member function which returns the growth size for the collection.
public:
virtual unsigned int getCapacityIncrement() const;
Abstract: A member function which returns the current number of objects within the collection.
public:
virtual unsigned int getCount() const;
Result: Returns the number of objects contained within the dictionary.
Abstract: A member function to find an object in the dictionary associated by a given key.
public:
virtual OSObject *getObject(const char *aKey) const;
Parameters
Name | Description |
aKey | The unique string identifying the object to be returned to caller. |
Result: Returns a reference to the object corresponding to the given key, or 0 if the key does not exist in the dictionary.
Abstract: A member function to find an object in the dictionary associated by a given key.
public:
virtual OSObject *getObject(const OSString *aKey) const;
Parameters
Name | Description |
aKey | The unique OSString key identifying the object to be returned to caller. |
Result: Returns a reference to the object corresponding to the given key, or 0 if the key does not exist in the dictionary.
Abstract: A member function to find an object in the dictionary associated by a given key.
public:
virtual OSObject *getObject(const OSSymbol *aKey) const;
Parameters
Name | Description |
aKey | The unique OSSymbol key identifying the object to be returned to caller. |
Result: Returns a reference to the object corresponding to the given key, or 0 if the key does not exist in the dictionary.
Abstract: A member function to initialize an instance of OSDictionary.
public:
virtual bool initWithCapacity(unsigned int capacity);
Parameters
Name | Description |
capacity | The initial storage capacity of the dictionary object. |
Result: Returns true if intialization succeeded or false on failure.
Abstract: A member function to initialize an instance of OSDictionary and populate it with the contents of another dictionary.
public:
virtual bool initWithDictionary(const OSDictionary *dict,
unsigned int capacity = 0);
Parameters
Name | Description |
dict | The dictionary contining the objects to be used to populate the receiving dictionary. |
capacity | The initial storage capacity of the dictionary. If 0, the value of capacity will be set to the number of elements in the dictionary object, else the value of capacity must be greater than or equal to the number of elements in the dictionary object. |
Result: Returns true if intialization succeeded or false on failure.
Abstract: A member function to initialize an instance of OSDictionary and populate it with the provided objects and keys.
public:
virtual bool initWithObjects(OSObject *objects[],
OSString *keys[],
unsigned int count,
unsigned int capacity = 0);
Parameters
Name | Description |
objects | A static array of OSObject derived objects to be placed into the dictionary. |
keys | A static array of OSString keys which identify the correspoding objects provided in the 'objects' parameter. |
count | The number of objects provided to the dictionary. |
capacity | The initial storage capacity of the dictionary object. If 0, the capacity will be set to the size of 'count', else the capacity must be greater than or equal to the value of 'count'. |
Result: Returns true if intialization succeeded or false on failure.
Abstract: A member function to initialize an instance of OSDictionary and populate it with the provided objects and keys.
public:
virtual bool initWithObjects(OSObject *objects[],
const OSSymbol *keys[],
unsigned int count,
unsigned int capacity = 0);
Parameters
Name | Description |
objects | A static array of OSObject derived objects to be placed into the dictionary. |
keys | A static array of OSSymbol keys which identify the correspoding objects provided in the 'objects' parameter. |
count | The number of objects provided to the dictionary. |
capacity | The initial storage capacity of the dictionary object. If 0, the capacity will be set to the size of 'count', else the capacity must be greater than or equal to the value of 'count'. |
Result: Returns true if intialization succeeded or false on failure.
Abstract: A member function to test the equality of two dictionaries.
public:
virtual bool isEqualTo(OSDictionary *aDictionary) const;
Parameters
Name | Description |
aDictionary | The dictionary to be compared against the receiver. |
Result: Returns true if the dictionaries are equal.
Abstract: A member function to test the equality of the intersections of two dictionaries.
public:
virtual bool isEqualTo(OSDictionary *aDictionary, OSCollection *keys) const;
Parameters
Name | Description |
aDictionary | The dictionary to be compared against the receiver. |
keys | An OSArray or OSDictionary containing the keys describing the intersecion for the comparison. |
Result: Returns true if the intersections of the two dictionaries are equal.
Abstract: A member function to test the equality between the receiver and an unknown object.
public:
virtual bool isEqualTo(const OSObject *anObject) const;
Parameters
Name | Description |
anObject | An object to be compared against the receiver. |
Result: Returns true if the objects are equal.
Abstract: A member function which merges the contents of a dictionary into the receiver.
public:
virtual bool merge(const OSDictionary *aDictionary);
If there are keys in 'aDictionary' which match keys in the receiving dictionary, then the objects in the receiver are replaced by those from 'aDictionary', the replaced objects are released.
Parameters
Name | Description |
aDictionary | The dictionary whose contents are to be merged with the receiver. |
Result: Returns true if the merger is successful, false otherwise.
Abstract: A member function which removes an object from the dictionary. The removed object is automatically released.
public:
virtual void removeObject(const char *aKey);
Parameters
Name | Description |
aKey | A unique string identifying the object to be removed from the dictionary. |
Abstract: A member function which removes an object from the dictionary. The removed object is automatically released.
public:
virtual void removeObject(const OSString *aKey);
Parameters
Name | Description |
aKey | A unique OSString identifying the object to be removed from the dictionary. |
Abstract: A member function which removes an object from the dictionary. The removed object is automatically released.
public:
virtual void removeObject(const OSSymbol *aKey);
Parameters
Name | Description |
aKey | A unique OSSymbol identifying the object to be removed from the dictionary. |
Abstract: A member function which archives the receiver.
public:
virtual bool serialize(OSSerialize *s) const;
Parameters
Name | Description |
s | The OSSerialize object. |
Result: Returns true if serialization was successful, false if not.
Abstract: A member function to set the growth size of the collection.
public:
virtual unsigned int setCapacityIncrement(unsigned increment);
Parameters
Name | Description |
increment | The new growth size. |
Result: Returns the new capacity increment.
Abstract: A member function which places an object into the dictionary and identifed by a unique key.
public:
virtual bool setObject(const OSString *aKey, OSObject *anObject);
Parameters
Name | Description |
aKey | A unique OSString identifying the object placed within the collection. |
anObject | The object to be stored in the dictionary. It is automatically retained. |
Result: Returns true if the addition of an object was successful, false otherwise.
Abstract: A member function which places an object into the dictionary and identifed by a unique key.
public:
virtual bool setObject(const char *aKey, OSObject *anObject);
Parameters
Name | Description |
aKey | A unique string identifying the object placed within the collection. |
anObject | The object to be stored in the dictionary. It is automatically retained. |
Result: Returns true if the addition of an object was successful, false otherwise.
Abstract: A member function which places an object into the dictionary and identifed by a unique key.
public:
virtual bool setObject(const OSSymbol *aKey, OSObject *anObject);
Parameters
Name | Description |
aKey | A unique OSSymbol identifying the object placed within the collection. |
anObject | The object to be stored in the dictionary. It is automatically retained. |
Result: Returns true if the addition of an object was successful, false otherwise.
Abstract: A static constructor function to create and initialize an instance of OSDictionary.
public:
static OSDictionary *withCapacity(unsigned int capacity);
Parameters
Name | Description |
capacity | The initial storage capacity of the dictionary object. |
Result: Returns an instance of OSDictionary or 0 on failure.
Abstract: A static constructor function to create and initialize an instance of OSDictionary and populate it with objects from another dictionary.
public:
static OSDictionary *withDictionary(const OSDictionary *dict,
unsigned int capacity = 0);
Parameters
Name | Description |
dict | A dictionary whose contents will be placed in the new instance. |
capacity | The initial storage capacity of the dictionary object. If 0, the capacity will be set to the number of elements in the dictionary object, else the capacity must be greater than or equal to the number of elements in the dictionary. |
Result: Returns an instance of OSDictionary or 0 on failure.
Abstract: A static constructor function to create and initialize an instance of OSDictionary and populate it with objects provided.
public:
static OSDictionary *withObjects(OSObject *objects[],
OSString *keys[],
unsigned int count,
unsigned int capacity = 0);
Parameters
Name | Description |
objects | A static array of OSObject derived objects. |
keys | A static array of OSString keys. |
count | The number of items to be placed into the dictionary. |
capacity | The initial storage capacity of the dictionary object. If 0, the capacity will be set to the size of 'count', else this value must be greater or equal to 'count'. |
Result: Returns an instance of OSDictionary or 0 on failure.
Abstract: A static constructor function to create and initialize an instance of OSDictionary and populate it with objects provided.
public:
static OSDictionary *withObjects(OSObject *objects[],
const OSSymbol *keys[],
unsigned int count,
unsigned int capacity = 0);
Parameters
Name | Description |
objects | A static array of OSObject derived objects. |
keys | A static array of OSSymbol keys. |
count | The number of items to be placed into the dictionary. |
capacity | The initial storage capacity of the dictionary object. If 0, the capacity will be set to the size of 'count', else this value must be greater or equal to 'count'. |
Result: Returns an instance of OSDictionary or 0 on failure.
© 2000 Apple Computer, Inc. (Last Updated 2/23/2000)