| 50 | { |
| 51 | |
| 52 | class CJsonObject |
| 53 | { |
| 54 | public: // method of ordinary json object or json array |
| 55 | CJsonObject(); |
| 56 | CJsonObject(const std::string& strJson); |
| 57 | CJsonObject(const CJsonObject* pJsonObject); |
| 58 | CJsonObject(const CJsonObject& oJsonObject); |
| 59 | #if __cplusplus >= 201101L |
| 60 | CJsonObject(CJsonObject&& oJsonObject); |
| 61 | #endif |
| 62 | virtual ~CJsonObject(); |
| 63 | |
| 64 | CJsonObject& operator=(const CJsonObject& oJsonObject); |
| 65 | #if __cplusplus >= 201101L |
| 66 | CJsonObject& operator=(CJsonObject&& oJsonObject); |
| 67 | #endif |
| 68 | bool operator==(const CJsonObject& oJsonObject) const; |
| 69 | bool Parse(const std::string& strJson); |
| 70 | void Clear(); |
| 71 | bool IsEmpty() const; |
| 72 | bool IsArray() const; |
| 73 | std::string ToString() const; |
| 74 | std::string ToFormattedString() const; |
| 75 | const std::string& GetErrMsg() const |
| 76 | { |
| 77 | return(m_strErrMsg); |
| 78 | } |
| 79 | |
| 80 | public: // method of ordinary json object |
| 81 | bool AddEmptySubObject(const std::string& strKey); |
| 82 | bool AddEmptySubArray(const std::string& strKey); |
| 83 | bool GetKey(std::string& strKey); |
| 84 | void ResetTraversing(); |
| 85 | CJsonObject& operator[](const std::string& strKey); |
| 86 | std::string operator()(const std::string& strKey) const; |
| 87 | bool KeyExist(const std::string& strKey) const; |
| 88 | bool Get(const std::string& strKey, CJsonObject& oJsonObject) const; |
| 89 | bool Get(const std::string& strKey, std::string& strValue) const; |
| 90 | bool Get(const std::string& strKey, int32& iValue) const; |
| 91 | bool Get(const std::string& strKey, uint32& uiValue) const; |
| 92 | bool Get(const std::string& strKey, int64& llValue) const; |
| 93 | bool Get(const std::string& strKey, uint64& ullValue) const; |
| 94 | bool Get(const std::string& strKey, bool& bValue) const; |
| 95 | bool Get(const std::string& strKey, float& fValue) const; |
| 96 | bool Get(const std::string& strKey, double& dValue) const; |
| 97 | int GetValueType(const std::string& strKey) const; |
| 98 | bool IsNull(const std::string& strKey) const; |
| 99 | bool Add(const std::string& strKey, const CJsonObject& oJsonObject); |
| 100 | #if __cplusplus < 201101L |
| 101 | bool AddWithMove(const std::string& strKey, CJsonObject& oJsonObject); |
| 102 | #else |
| 103 | bool Add(const std::string& strKey, CJsonObject&& oJsonObject); |
| 104 | #endif |
| 105 | bool Add(const std::string& strKey, const std::string& strValue); |
| 106 | bool Add(const std::string& strKey, int32 iValue); |
| 107 | bool Add(const std::string& strKey, uint32 uiValue); |
| 108 | bool Add(const std::string& strKey, int64 llValue); |
| 109 | bool Add(const std::string& strKey, uint64 ullValue); |
nothing calls this directly
no outgoing calls
no test coverage detected