cs::CSJsonDictionary类公开成员函数说明

cs::CSJsonDictionary是cocos2d-x拓展(extensions)里面的一个json类,下面对其public的函数进行说明 :
        void    initWithDescription(const char *pszDescription);//用json文本数据去初始化对象
        void    insertItem(const char *pszKey, int nValue);//写入int数据
        void    insertItem(const char *pszKey, double fValue);//写入float数据
        void    insertItem(const char *pszKey, const char * pszValue);//写入字符串数据
        void    insertItem(const char *pszKey, CSJsonDictionary * subDictionary);//写入json数据
        void    insertItem(const char *pszKey, bool bValue);//写入布尔数据
        bool    deleteItem(const char *pszKey);//删除某数据
        void    cleanUp();//清除所有数据
        bool    isKeyValidate(const char *pszKey);//判断是否有对应的值


	int             getItemIntValue(const char *pszKey, int nDefaultValue);//读取int数据
        double          getItemFloatValue(const char *pszKey, double fDefaultValue);//读取float数据
        const char *    getItemStringValue(const char *pszKey);//读取字符串数据
        bool            getItemBoolvalue(const char *pszKey, bool bDefaultValue);//读取布尔数据
        CSJsonDictionary *   getSubDictionary(const char *pszKey);//获得json数据


	std::string          getDescription();//获得描述,实际就是获得数据文本


	bool    insertItemToArray(const char *pszArrayKey, int nValue);//插入pszArrayKey数组一个int值
        bool    insertItemToArray(const char *pszArrayKey, double fValue);//插入pszArrayKey数组一个float值
        bool    insertItemToArray(const char *pszArrayKey, const char * pszValue);//插入pszArrayKey数组一个文本
        bool    insertItemToArray(const char *pszArrayKey, CSJsonDictionary * subDictionary);//插入pszArrayKey数组一个json


	int getArrayItemCount(const char *pszArrayKey);//获得pszArrayKey的成员数目
        int getIntValueFromArray(const char *pszArrayKey, int nIndex, int nDefaultValue);//获得pszArrayKey第nIndex个的int数据
        double getFloatValueFromArray(const char *pszArrayKey, int nIndex, double fDefaultValue);//获得pszArrayKey第nIndex个的float数据
        bool getBoolValueFromArray(const char *pszArrayKey, int nIndex, bool bDefaultValue);//获得pszArrayKey第nIndex个的bool数据
        const char * getStringValueFromArray(const char *pszArrayKey, int nIndex);//获得pszArrayKey第nIndex个的文本
        CSJsonDictionary *getSubItemFromArray(const char *pszArrayKey, int nIndex);//获得pszArrayKey第nIndex个的json数据
        DicItemType getItemTypeFromArray(const char *pszArrayKey, int nIndex);//获得pszArrayKey第nIndex个的json类型


	int         getItemCount();//获得json数据的成员个数
        DicItemType getItemType(int nIndex);//获得第nIndex个成员的类型
        DicItemType getItemType(const char *pszKey);//获得成员的类型
        std::vector<std::string> getAllMemberNames();//获得所有成员的key的std::string列表


评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值