Class CCDictElement

#include <Geode/cocos/cocoa/CCDictionary.h>
classCCDictElement{ ... }

CCDictElement is used for traversing CCDictionary.

A CCDictElement is one element of CCDictionary, it contains two properties, key and object. Its key has two different type (integer and string).

ℹ The key type is unique, all the elements in CCDictionary has the same key type(integer or string).

Examples1
CCDictElement* pElement;
CCDICT_FOREACH(dict, pElement)
{
    const char*key = pElement->getStrKey();
    // You certainly know the type of value, so we assume that it's a CCSprite.
    CCSprite* pSprite = (CCSprite*)pElement->getObject();
    // ......
}
Public static methods0
Public member functions3
charconst*getStrKey()const

Get the string key of this element.

Return value
The string key of this element.

ℹ This method assumes you know the key type in the element. If the element's key type is integer, invoking this method will cause an assert.

intptr_tgetIntKey()const

Get the integer key of this element.

Return value
The integer key of this element.

ℹ This method assumes you know the key type in the element. If the element's key type is string, invoking this method will cause an assert.

cocos2d::CCObject*getObject()const

Get the object of this element.

Return value
The object of this element.
Fields1
;
No description provided
Protected member functions0
Protected fields0