// // HJSONParseUtils.h // SteveMaggieCpp // // Created by Katarzyna Kalinowska-Górska on 19.05.2017. // // #ifndef HJSONParseUtils_h #define HJSONParseUtils_h #include "json/document.h" #include #include #include "cocos2d.h" using namespace rapidjson; class HJSONParseUtils { public: static bool hasMemberBool(const Value& json, const char* memberName); static bool hasMemberInt(const Value& json, const char* memberName); static bool hasMemberFloat(const Value& json, const char* memberName); static bool hasMemberString(const Value& json, const char* memberName); static bool hasMemberArray(const Value& json, const char* memberName); static bool hasMemberObject(const Value& json, const char* memberName); static bool hasMemberPoint(const Value& json, const char* memberName); static cocos2d::Point getMemberPoint(const Value& json, const char* memberName); static bool isPoint(const Value& json); static cocos2d::Point getPoint(const Value& json); static bool hasMemberSize(const Value& json, const char* memberName); static cocos2d::Point getMemberSize(const Value& json, const char* memberName); static bool isSize(const Value& json); static cocos2d::Size getSize(const Value& json); static bool hasMemberRect(const Value& json, const char* memberName); static cocos2d::Rect getMemberRect(const Value& json, const char* memberName); static bool isRect(const Value& json); static cocos2d::Rect getRect(const Value& json); static bool hasMemberColor3B(const Value& json, const char* memberName); static cocos2d::Color3B getMemberColor3B(const Value& json, const char* memberName); static bool isColor3B(const Value& json); static cocos2d::Color3B getColor3B(const Value& json); static bool hasMemberColor4F(const Value& json, const char* memberName); static cocos2d::Color4F getMemberColor4F(const Value& json, const char* memberName); static bool isColor4F(const Value& json); static cocos2d::Color4F getColor4F(const Value& json); static bool checkMemberBool(const Value& json, const char* memberName, bool expectedValue); static bool checkMemberFloat(const Value& json, const char* memberName, float expectedValue); static bool checkMemberInt(const Value& json, const char* memberName, int expectedValue); static bool checkMemberString(const Value& json, const char* memberName, std::string expectedValue); static std::vector parseStringArray(const Value& json); static std::vector parseFloatArray(const Value& json); static std::vector parseIntArray(const Value& json); static std::vector parsePointArray(const Value& json); static std::vector parseSizeArray(const Value& json); static std::vector parseRectArray(const Value& json); static std::vector parseMemberStringArray(const Value& json, const char* memberName); static std::vector parseMemberFloatArray(const Value& json, const char* memberName); static std::vector parseMemberIntArray(const Value& json, const char* memberName); static std::vector parseMemberPointArray(const Value& json, const char* memberName); }; #endif /* HJSONParseUtils_h */