Class CCUserDefault

#include <Geode/cocos/support/user_default/CCUserDefault.h>
classCCUserDefault{ ... }

CCUserDefault acts as a tiny database. You can save and get base type values by it. For example, setBoolForKey(“played”, true) will add a bool value true into the database. Its key is “played”. You can get the value of the key by getBoolForKey(“played”).

It supports the following base types: bool, int, float, double, string

Examples0
Public static methods4
staticcocos2d::CCUserDefault*sharedUserDefault()
No description provided
staticvoidpurgeSharedUserDefault()
No description provided
staticgd::stringconst&getXMLFilePath()
No description provided
staticboolisXMLFileExist()
No description provided
Public member functions16
boolgetBoolForKey()

Get bool value by key, if the key doesn’t exist, a default value will return. You can set the default value, or it is false.

boolgetBoolForKey(,
booldefaultValue
)
No description provided
intgetIntegerForKey()

Get integer value by key, if the key doesn’t exist, a default value will return. You can set the default value, or it is 0.

intgetIntegerForKey(,
intdefaultValue
)
No description provided
floatgetFloatForKey()

Get float value by key, if the key doesn’t exist, a default value will return. You can set the default value, or it is 0.0f.

floatgetFloatForKey(,
floatdefaultValue
)
No description provided
doublegetDoubleForKey()

Get double value by key, if the key doesn’t exist, a default value will return. You can set the default value, or it is 0.0.

doublegetDoubleForKey(,
doubledefaultValue
)
No description provided
gd::stringgetStringForKey()

Get string value by key, if the key doesn’t exist, a default value will return. You can set the default value, or it is “”.

gd::stringgetStringForKey(,
gd::stringconst&defaultValue
)
No description provided
voidsetBoolForKey(,
boolvalue
)

Set bool value by key.

voidsetIntegerForKey(,
intvalue
)

Set integer value by key.

voidsetFloatForKey(,
floatvalue
)

Set float value by key.

voidsetDoubleForKey(,
doublevalue
)

Set double value by key.

voidsetStringForKey(,)

Set string value by key.

voidflush()

Save content to xml file

Fields0
Protected member functions0
Protected fields0