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