Dictionary is a class like NSDictionary in Obj-C . More...
#include <CCDictionary.h>
Public Member Functions | |
__Dictionary () | |
The constructor of Dictionary. More... | |
~__Dictionary () | |
The destructor of Dictionary. More... | |
bool | init () |
Initializes the dictionary. More... | |
unsigned int | count () |
Get the count of elements in Dictionary. More... | |
local | count () |
Get the count of elements in Dictionary. More... | |
__Array * | allKeys () |
Return all keys of elements. More... | |
__Array * | allKeysForObject (Object *object) |
Get all keys according to the specified object. More... | |
local | allKeysForObject ( local object) |
Get all keys according to the specified object. More... | |
Object * | objectForKey (const std::string &key) |
Get the object according to the specified string key. More... | |
Object * | objectForKey (intptr_t key) |
Get the object according to the specified integer key. More... | |
const __String * | valueForKey (const std::string &key) |
Get the value according to the specified string key. More... | |
local | valueForKey ( local key) |
Get the value according to the specified string key. More... | |
const __String * | valueForKey (intptr_t key) |
Get the value according to the specified integer key. More... | |
local | valueForKey ( local key) |
Get the value according to the specified integer key. More... | |
void | setObject (Object *pObject, const std::string &key) |
Insert an object to dictionary, and match it with the specified string key. More... | |
void | setObject (Object *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 (__Array *pKey__Array) |
Remove objects by an array of keys. More... | |
void | removeObjectForElememt (DictElement *pElement) |
Remove an object by an element. More... | |
void | removeAllObjects () |
Remove all objects in the dictionary. More... | |
Object * | 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 (DataVisitor &visitor) |
virtual __Dictionary * | clone () const |
returns a copy of the object More... | |
Public Member Functions inherited from Object | |
Object () | |
Constructor. More... | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
void | release () |
Release the ownership immediately. More... | |
void | retain () |
Retains the ownership. More... | |
Object * | autorelease () |
Release the ownership sometime soon automatically. More... | |
bool | isSingleReference () const |
Returns a boolean value that indicates whether there is only one reference to the object. More... | |
unsigned int | retainCount () const |
Returns the object's current reference count. More... | |
local | retainCount () |
Returns the object's current reference count. More... | |
virtual bool | isEqual (const Object *object) |
Returns a boolean value that indicates whether this object and a given object are equal. More... | |
virtual void | update (float dt) |
Public Member Functions inherited from Clonable | |
virtual | ~Clonable () |
Object * | copy () const |
returns a copy of the object. More... | |
var | copy () |
returns a copy of the object. More... | |
local | copy () |
returns a copy of the object. More... | |
Static Public Member Functions | |
static __Dictionary * | create () |
Create a dictionary. More... | |
local | create () |
Create a dictionary. More... | |
static __Dictionary * | createWithDictionary (__Dictionary *srcDict) |
Create a dictionary with an existing dictionary. More... | |
static __Dictionary * | createWithContentsOfFile (const char *pFileName) |
Create a dictionary with a plist file. More... | |
static __Dictionary * | createWithContentsOfFileThreadSafe (const char *pFileName) |
Create a dictionary with a plist file. More... | |
Public Attributes | |
DictElement * | _elements |
All the elements in dictionary. More... | |
Public Attributes inherited from Object | |
unsigned int | _ID |
object id, ScriptSupport need public _ID More... | |
int | _luaID |
Lua reference id. More... | |
var | _luaID |
Lua reference id. More... | |
local | _luaID |
Lua reference id. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Object | |
unsigned int | _reference |
count of references More... | |
var | _reference |
count of references More... | |
local | _reference |
count of references More... | |
unsigned int | _autoReleaseCount |
count of autorelease More... | |
var | _autoReleaseCount |
count of autorelease More... | |
local | _autoReleaseCount |
count of autorelease More... | |
Dictionary is a class like NSDictionary in Obj-C .
__Dictionary | ( | ) |
The constructor of Dictionary.
~__Dictionary | ( | ) |
The destructor of Dictionary.
|
virtual |
Reimplemented from Object.
|
virtual |
Reimplemented from Object.
|
virtual |
Reimplemented from Object.
__Array* allKeys | ( | ) |
Return all keys of elements.
local allKeys | ( | ) |
Return all keys of elements.
Get all keys according to the specified object.
local allKeysForObject | ( | local | object) |
Get all keys according to the specified object.
|
virtual |
returns a copy of the object
Implements Clonable.
unsigned int count | ( | ) |
Get the count of elements in Dictionary.
local count | ( | ) |
Get the count of elements in Dictionary.
|
static |
Create a dictionary.
|
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 a plist file.
pFileName | The name of the plist file. |
|
static |
Create a dictionary with an existing dictionary.
srcDict | The exist dictionary. |
|
static |
Create a dictionary with an existing dictionary.
srcDict | The exist dictionary. |
bool init | ( | ) |
Initializes the dictionary.
It returns true if the initializations was successful.
Object* objectForKey | ( | const std::string & | key) |
Get the object according to the specified string key.
key | The string key for searching. |
local objectForKey | ( | local | 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. |
local objectForKey | ( | local | key) |
Get the object according to the specified integer key.
key | The integer key for searching. |
Object* randomObject | ( | ) |
Return a random object in the dictionary.
void removeAllObjects | ( | ) |
Remove all objects in the dictionary.
local removeAllObjects | ( | ) |
Remove all objects in the dictionary.
void removeObjectForElememt | ( | DictElement * | 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. |
local removeObjectForKey | ( | local | 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. |
local removeObjectForKey | ( | local | key) |
Remove an object by the specified integer key.
key | The integer key for searching. |
void removeObjectsForKeys | ( | __Array * | pKey__Array) |
Remove objects by an array of keys.
pKeyArray | The array contains keys to be removed. |
local removeObjectsForKeys | ( | local | pKey__Array) |
Remove objects by an array of keys.
pKeyArray | The array contains keys to be removed. |
void setObject | ( | Object * | 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. |
local setObject | ( | local | pObject, |
local | 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. |
local setObject | ( | local | pObject, |
local | 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. |
const __String* valueForKey | ( | const std::string & | key) |
Get the value according to the specified string key.
key | The string key for searching |
local valueForKey | ( | local | 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. |
local valueForKey | ( | local | key) |
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() |
DictElement* _elements |
All the elements in dictionary.
var _elements |
All the elements in dictionary.
local _elements |
All the elements in dictionary.