cocos2d-x
2.2.3-gd2.113-rev1ec524e
|
CCDictionary is a class like NSDictionary in Obj-C . More...
#include <CCDictionary.h>
Public Member Functions | |
CCDictionary () | |
The constructor of CCDictionary. More... | |
~CCDictionary () | |
The destructor of CCDictionary NA. 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... | |
![]() | |
CCObject (void) | |
virtual | ~CCObject (void) |
NA. More... | |
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 | acceptVisitor (CCDataVisitor &visitor) |
virtual void | update (float dt) |
CCObject (const CCObject &) | |
CCObject & | operator= (const CCObject &) |
virtual void | encodeWithCoder (DS_Dictionary *) |
virtual bool | canEncode () |
CCObjectType | getObjType () const |
virtual int | getTag () const |
virtual void | setTag (int nTag) |
void | setObjType (CCObjectType) |
virtual CCObject * | copyWithZone (CCZone *pZone) |
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... | |
![]() | |
static CCObject * | createWithCoder (DS_Dictionary *) |
Public Attributes | |
CCDictElement * | m_pElements |
All the elements in dictionary. More... | |
![]() | |
unsigned int | m_uID |
int | m_nLuaID |
Additional Inherited Members | |
![]() | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
int | m_nTag |
int | m_eObjType |
unsigned int | m_uObjectIdxInArray |
CCDictionary is a class like NSDictionary in Obj-C .
CCDictionary | ( | ) |
The constructor of CCDictionary.
NA
~CCDictionary | ( | ) |
The destructor of CCDictionary NA.
|
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. NA NA
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.