@ More...
#include <CCDictionary.h>
Public Member Functions | |
CCDictionary () | |
The constructor of CCDictionary. More... | |
~CCDictionary () | |
The destructor of CCDictionary. More... | |
unsigned int | count () |
Get the count of elements in CCDictionary. More... | |
CCArray * | allKeys () |
Return all keys of elements. More... | |
CCArray * | allKeysForObject (CCObject *object) |
Get all keys according to the specified object. More... | |
CCObject * | objectForKey (const std::string &key) |
Get the object according to the specified string key. More... | |
CCObject * | objectForKey (intptr_t key) |
Get the object according to the specified integer key. More... | |
const CCString * | valueForKey (const std::string &key) |
Get the value according to the specified string key. More... | |
const CCString * | valueForKey (intptr_t key) |
Get the value according to the specified integer key. More... | |
void | setObject (CCObject *pObject, const std::string &key) |
Insert an object to dictionary, and match it with the specified string key. More... | |
void | setObject (CCObject *pObject, intptr_t key) |
Insert an object to dictionary, and match it with the specified string key. More... | |
void | removeObjectForKey (const std::string &key) |
Remove an object by the specified string key. More... | |
void | removeObjectForKey (intptr_t key) |
Remove an object by the specified integer key. More... | |
void | removeObjectsForKeys (CCArray *pKeyArray) |
Remove objects by an array of keys. More... | |
void | removeObjectForElememt (CCDictElement *pElement) |
Remove an object by an element. More... | |
void | removeAllObjects () |
Remove all objects in the dictionary. More... | |
CCObject * | randomObject () |
Return a random object in the dictionary. More... | |
bool | writeToFile (const char *fullPath) |
Write a dictionary to a plist file. More... | |
virtual void | acceptVisitor (CCDataVisitor &visitor) |
Function override | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
This function is used for deepcopy elements from source dictionary to destination dictionary. More... | |
Public Member Functions inherited from CCObject | |
CCObject (void) | |
virtual | ~CCObject (void) |
void | release (void) |
void | retain (void) |
CCObject * | autorelease (void) |
CCObject * | copy (void) |
bool | isSingleReference (void) const |
unsigned int | retainCount (void) const |
virtual bool | isEqual (const CCObject *pObject) |
virtual void | update (float dt) |
Static Public Member Functions | |
static CCDictionary * | create () |
Create a dictionary. More... | |
static CCDictionary * | createWithDictionary (CCDictionary *srcDict) |
Create a dictionary with an existing dictionary. More... | |
static CCDictionary * | createWithContentsOfFile (const char *pFileName) |
Create a dictionary with a plist file. More... | |
static CCDictionary * | createWithContentsOfFileThreadSafe (const char *pFileName) |
Create a dictionary with a plist file. More... | |
Public Attributes | |
CCDictElement * | m_pElements |
All the elements in dictionary. More... | |
Public Attributes inherited from CCObject | |
unsigned int | m_uID |
int | m_nLuaID |
Additional Inherited Members | |
Protected Attributes inherited from CCObject | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
@
CCDictionary | ( | ) |
The constructor of CCDictionary.
~CCDictionary | ( | ) |
The destructor of CCDictionary.
|
virtual |
Reimplemented from CCObject.
CCArray* allKeys | ( | ) |
Return all keys of elements.
Get all keys according to the specified object.
This function is used for deepcopy elements from source dictionary to destination dictionary.
You shouldn't invoke this function manually since it's called by CCObject::copy.
Reimplemented from CCCopying.
unsigned int count | ( | ) |
Get the count of elements in CCDictionary.
|
static |
Create a dictionary.
|
static |
Create a dictionary with a plist file.
pFileName | The name of the plist file. |
|
static |
Create a dictionary with a plist file.
pFileName | The name of the plist file. |
|
static |
Create a dictionary with an existing dictionary.
srcDict | The exist dictionary. |
CCObject* objectForKey | ( | const std::string & | key) |
Get the object according to the specified string key.
key | The string key for searching. |
Get the object according to the specified integer key.
key | The integer key for searching. |
CCObject* randomObject | ( | ) |
Return a random object in the dictionary.
void removeAllObjects | ( | ) |
Remove all objects in the dictionary.
void removeObjectForElememt | ( | CCDictElement * | pElement) |
Remove an object by an element.
pElement | The element need to be removed. |
void removeObjectForKey | ( | const std::string & | key) |
Remove an object by the specified string key.
key | The string key for searching. |
void removeObjectForKey | ( | intptr_t | key) |
Remove an object by the specified integer key.
key | The integer key for searching. |
void removeObjectsForKeys | ( | CCArray * | pKeyArray) |
Remove objects by an array of keys.
pKeyArray | The array contains keys to be removed. |
void setObject | ( | CCObject * | pObject, |
const std::string & | key | ||
) |
Insert an object to dictionary, and match it with the specified string key.
pObject | The Object to be inserted. |
key | The string key for searching. |
Insert an object to dictionary, and match it with the specified string key.
pObject | The Object to be inserted. |
key | The string key for searching. |
const CCString* valueForKey | ( | const std::string & | key) |
Get the value according to the specified string key.
key | The string key for searching |
Get the value according to the specified integer key.
key | The string key for searching. |
bool writeToFile | ( | const char * | fullPath) |
Write a dictionary to a plist file.
fullPath | The full path of the plist file. You can get writeable path by getWritablePath() |
CCDictElement* m_pElements |
All the elements in dictionary.