#pragma once #include #define RAPIDJSON_HAS_STDSTRING 1 #include "rapidjson/document.h" #include "rapidjson/encodings.h" #include "rapidjson/stringbuffer.h" #include "rapidjson/filereadstream.h" #include "rapidjson/filewritestream.h" #include "rapidjson/encodedstream.h" #include "rapidjson/prettywriter.h" #include "rapidjson/pointer.h" #ifdef AECRXBASE_EXPORT #define AECDLLIMPEXP __declspec(dllexport) #else #define AECDLLIMPEXP __declspec(dllimport) #endif namespace SHJson { using namespace rapidjson; typedef GenericDocument > WDocument; typedef GenericValue > WValue; typedef const GenericValue > WCValue; typedef GenericArray Arr; typedef GenericArray CArr; typedef WValue::ConstMemberIterator MCIt; typedef WValue::MemberIterator MIt; typedef WValue::ConstValueIterator VCIt; typedef WValue::ValueIterator VIt; typedef GenericStringBuffer > WStringBuffer; typedef PrettyWriter, UTF16<>> WPrettyWriter; typedef Writer, UTF16<>> WWriter; typedef GenericPointer WPointer; typedef GenericPointer WCPointer; AECDLLIMPEXP WDocument::AllocatorType &getJsonAllocator(); AECDLLIMPEXP std::wstring write2Json(const WValue &v, bool pretty = false); AECDLLIMPEXP WDocument &string2Json(LPCTSTR json, WDocument &doc); AECDLLIMPEXP bool json2File(LPCTSTR path, const WValue &v, bool pretty = false); AECDLLIMPEXP bool file2Json(LPCTSTR path, WDocument &doc); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, WValue &value); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, const int &value); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, const unsigned &value); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, const __int64 &value); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, const unsigned __int64 &value); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, const bool &value); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, const double &value); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, const float &value); AECDLLIMPEXP WValue& addMember(WValue &object, LPCTSTR name, LPCTSTR value); AECDLLIMPEXP WValue& pushBack(WValue &arr, WValue &value); AECDLLIMPEXP WValue& pushBack(WValue &arr, const int &value); AECDLLIMPEXP WValue& pushBack(WValue &arr, const unsigned &value); AECDLLIMPEXP WValue& pushBack(WValue &arr, const __int64 &value); AECDLLIMPEXP WValue& pushBack(WValue &arr, const unsigned __int64 &value); AECDLLIMPEXP WValue& pushBack(WValue &arr, const bool &value); AECDLLIMPEXP WValue& pushBack(WValue &arr, const double &value); AECDLLIMPEXP WValue& pushBack(WValue &arr, const float &value); AECDLLIMPEXP WValue& pushBack(WValue &arr, LPCTSTR value); }