Blame view

ios/Runner/Wowgame/Classes/game_animal/AniJSONParseUtils.h 3.67 KB
5daad4bc   xiaoyu   游戏源码添加编译(现存问题:游戏内...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
  //
  //  AniJSONParseUtils.h
  //  SteveMaggieCpp
  //
  //  Created by Katarzyna Kalinowska-Górska on 19.05.2017.
  //
  //
  
  #ifndef AniJSONParseUtils_h
  #define AniJSONParseUtils_h
  
  #include "json/document.h"
  #include <vector>
  #include <string>
  #include "cocos2d.h"
  
  using namespace rapidjson;
  
  class AniJSONParseUtils
  {
  public:
      
      static std::string loadJSONFromFile(const std::string& jsonFilePath);
      
          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<rapidjson::Value*> parseValueArray(const Value& json, rapidjson::CrtAllocator* allocator);
          static std::vector<std::string> parseStringArray(const Value& json);
          static std::vector<float> parseFloatArray(const Value& json);
          static std::vector<int> parseIntArray(const Value& json);
          static std::vector<cocos2d::Point> parsePointArray(const Value& json);
          static std::vector<cocos2d::Size> parseSizeArray(const Value& json);
          static std::vector<cocos2d::Rect> parseRectArray(const Value& json);
      
          static std::vector<std::string> parseMemberStringArray(const Value& json, const char* memberName);
          static std::vector<float> parseMemberFloatArray(const Value& json, const char* memberName);
          static std::vector<int> parseMemberIntArray(const Value& json, const char* memberName);
          static std::vector<cocos2d::Point> parseMemberPointArray(const Value& json, const char* memberName);
  };
  
  #endif /* AniJSONParseUtils_h */