1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #ifndef _OTHER_PUBLICFUNCEXPORT_HEADER_
- #define _OTHER_PUBLICFUNCEXPORT_HEADER_
- #pragma once
- #include "cJSON.h"
- #include <map>
- #include <string>
- #include <vector>
- #include "publicExport.h"
- using namespace std;
- #define STR_TRUE "True"
- #define STR_FALSE "False"
- #define STR_NULL "Null"
- PUBLIC_API std::pair<bool, std::string> generateJsonStr(std::map<std::string, std::string> &objectArr);
- PUBLIC_API std::vector<std::string> parseJsonStr(const std::string jsonStr, const std::vector<std::string>& keys);
- PUBLIC_API bool checkHttpActive(const char* httpUrl);
- PUBLIC_API int str2int(const string str);
- PUBLIC_API string int2str(const int num);
- class PUBLIC_API RVCJson{
- public:
- cJSON* pJson;
- public:
- RVCJson();
- RVCJson(bool notNewArray);
- ~RVCJson();
- void SetJson(const char*jsonStr);
- void SetJson(RVCJson* cmbJson);
- void AddNullToObject(const char*key);
- void AddBoolToObject(const char*key, bool value);
- void AddNumberToObject(const char*key, double value);
- void AddStringToObject(const char*key, char*value);
- void AddItemToObject(const char*key, RVCJson* rvcJson);
- void AddItemToArray(RVCJson* rvcJson);
- RVCJson* Get();
- char*GetJsonStr();
- bool GetBoolValue(const char*key);
- double GetNumberValue(const char*key);
- int GetNumberIntValue(const char*key);
- char*GetStringValue(const char*key);
- RVCJson* GetJsonValue(const char*key);
- int GetArraySize();
- RVCJson* GetArrayValue(int index);
- void Destory();
- };
- #endif //_OTHER_PUBLICFUNCEXPORT_HEADER_
|