From 624340140493ab92ee606e591500dc576c1e4ac5 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 11 Dec 2013 15:08:00 +0800 Subject: [PATCH] issue #2790: ConfigurationTest fix. --- .../ConfigurationTest/ConfigurationTest.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/Cpp/TestCpp/Classes/ConfigurationTest/ConfigurationTest.cpp b/samples/Cpp/TestCpp/Classes/ConfigurationTest/ConfigurationTest.cpp index 7df99cf60e..feea02ad1d 100644 --- a/samples/Cpp/TestCpp/Classes/ConfigurationTest/ConfigurationTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ConfigurationTest/ConfigurationTest.cpp @@ -121,13 +121,13 @@ void ConfigurationQuery::onEnter() { ConfigurationBase::onEnter(); - CCLOG("cocos2d version: %s", Configuration::getInstance()->getCString("cocos2d.version") ); - CCLOG("OpenGL version: %s", Configuration::getInstance()->getCString("gl.version") ); + CCLOG("cocos2d version: %s", Configuration::getInstance()->getValue("cocos2d.x.version").asString().c_str() ); + CCLOG("OpenGL version: %s", Configuration::getInstance()->getValue("gl.version").asString().c_str() ); } std::string ConfigurationQuery::subtitle() { - return "Using getCString(). Check the console"; + return "Check the console"; } //------------------------------------------------------------------ @@ -156,19 +156,19 @@ void ConfigurationDefault::onEnter() { ConfigurationBase::onEnter(); - const char *c_value = Configuration::getInstance()->getCString("invalid.key", "no key"); - if( strcmp(c_value, "no key") != 0 ) + std::string c_value = Configuration::getInstance()->getValue("invalid.key", Value("no key")).asString(); + if( c_value != "no key" ) CCLOG("1. Test failed!"); else CCLOG("1. Test OK!"); - bool b_value = Configuration::getInstance()->getBool("invalid.key", true); + bool b_value = Configuration::getInstance()->getValue("invalid.key", Value(true)).asBool(); if( ! b_value ) CCLOG("2. Test failed!"); else CCLOG("2. Test OK!"); - double d_value = Configuration::getInstance()->getNumber("invalid.key", 42.42); + double d_value = Configuration::getInstance()->getValue("invalid.key", Value(42.42)).asDouble(); if( d_value != 42.42 ) CCLOG("3. Test failed!"); else @@ -192,9 +192,9 @@ void ConfigurationSet::onEnter() Configuration *conf = Configuration::getInstance(); - conf->setObject("this.is.an.int.value", Integer::create(10) ); - conf->setObject("this.is.a.bool.value", Bool::create(true) ); - conf->setObject("this.is.a.string.value", String::create("hello world") ); + conf->setValue("this.is.an.int.value", Value(10) ); + conf->setValue("this.is.a.bool.value", Value(true) ); + conf->setValue("this.is.a.string.value", Value("hello world") ); conf->dumpInfo(); }