cocos2d-x  3.0Beta0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DictElement Class Reference

DictElement is used for traversing Dictionary. More...

#include <CCDictionary.h>

Public Member Functions

 ~DictElement ()
 The destructor of DictElement. More...
 
const char * getStrKey () const
 Get the string key of this element. More...
 
var getStrKey ()
 Get the string key of this element. More...
 
local getStrKey ()
 Get the string key of this element. More...
 
intptr_t getIntKey () const
 Get the integer key of this element. More...
 
local getIntKey ()
 Get the integer key of this element. More...
 
ObjectgetObject () const
 Get the object of this element. More...
 

Public Attributes

UT_hash_handle hh
var hh
local hh

Friends

class __Dictionary

Detailed Description

DictElement is used for traversing Dictionary.

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

Note
The key type is unique, all the elements in Dictionary has the same key type(integer or string).
DictElement* pElement;
CCDICT_FOREACH(dict, pElement)
{
const char*key = pElement->getStrKey();
// You certainly know the type of value, so we assume that it's a Sprite.
Sprite* pSprite = static_cast<Sprite*>(pElement->getObject());
// ......
}

Constructor & Destructor Documentation

The destructor of DictElement.

Member Function Documentation

intptr_t getIntKey ( ) const
inline

Get the integer key of this element.

Note
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.
Returns
The integer key of this element.
var getIntKey ( )
inline

Get the integer key of this element.

Note
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.
Returns
The integer key of this element.
local getIntKey ( )
inline

Get the integer key of this element.

Note
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.
Returns
The integer key of this element.
Object* getObject ( ) const
inline

Get the object of this element.

Returns
The object of this element.
var getObject ( )
inline

Get the object of this element.

Returns
The object of this element.
local getObject ( )
inline

Get the object of this element.

Returns
The object of this element.
const char* getStrKey ( ) const
inline

Get the string key of this element.

Note
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.
Returns
The string key of this element.
var getStrKey ( )
inline

Get the string key of this element.

Note
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.
Returns
The string key of this element.
local getStrKey ( )
inline

Get the string key of this element.

Note
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.
Returns
The string key of this element.

Friends And Related Function Documentation

friend class __Dictionary
friend
var __Dictionary
friend
local __Dictionary
friend

Member Data Documentation

var hh
local hh

The documentation for this class was generated from the following file: