预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共39页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

json文件 { "xiaohong":[ { "id":1, "age":15, "email":"12123431243@qq.com" }, { "id":2, "age":25, "email":"12123431243@qq.com" } ], "xiaoming":[ { "id":1, "age":14, "email":"1sdfqewqwe2@qq.com" }, { "id":2, "age":23, "email":"asdfqwe22@qq.com" } ], "xiaoli":[ { "id":1, "age":54, "email":"sadfwqef23@qq.com" }, { "id":2, "age":345, "email":"erqwer@qq.com" } ] } xml文件 <?xmlversion="1.0"encoding="utf-8"?> <Root> <userid="001"> <adminsex="man"> <name>fred</name> <password>150150</password> <age>22</age> </admin> <adminsex="woman"> <name>yucai</name> <password>123456</password> <age>21</age> </admin> </user> </Root> *******HelloWorld.h******** #include"cocos2d.h" usingnamespacecocos2d; //使用rapidjson时需要包含的头文件json解析 //前两个用来解析文件,后两个用来更改文件 #include"json/document.h" #include"json/rapidjson.h" #include"json/stringbuffer.h" #include"json/writer.h" //使用tinyxml2操作xml文件需要包含的头文件 #include"tinyxml2/tinyxml2.h" usingnamespacetinyxml2; classHelloWorld:publiccocos2d::Layer { public: //there'sno'id'incpp,sowerecommendreturningtheclassinstancepointer staticcocos2d::Scene*createScene(); //Here'sadifference.Method'init'incocos2d-xreturnsbool,insteadofreturning'id'incocos2d-iphone virtualboolinit(); //aselectorcallback voidmenuCloseCallback(cocos2d::Ref*pSender); //implementthe"staticcreate()"methodmanually CREATE_FUNC(HelloWorld); voiduserDefaultTest(); //拷贝文件到可读写路径下测试函数 voidcopyFile(constchar*filename); voidrapidJsonTest(constchar*filename);//需要包含一些头文件 //xml测试函数 voidtinyxmlTest(constchar*filename); }; ***********HelloWorle.cpp******* #include"HelloWorldScene.h" USING_NS_CC; Scene*HelloWorld::createScene() { //'scene'isanautoreleaseobject autoscene=Scene::create(); //'layer'isanautoreleaseobject autolayer=HelloWorld::create(); //addlayerasachildtoscene scene->addChild(layer); //returnthescene returnscene; } //on"init"youneedtoinitializeyourinstance boolHelloWorld::init() { ////////////////////////////// //1.superinitfirst if(!Layer::init()) { returnfalse; } SizevisibleSize