Files
envi-code/SourceCode/Code2026/inc/shJson.h
T
2026-09-28 15:28:50 +08:00

67 lines
2.8 KiB
C++

#pragma once
#include <string>
#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<UTF16<> > WDocument;
typedef GenericValue<UTF16<> > WValue;
typedef const GenericValue<UTF16<> > WCValue;
typedef GenericArray<false, WValue> Arr;
typedef GenericArray<true, WValue> CArr;
typedef WValue::ConstMemberIterator MCIt;
typedef WValue::MemberIterator MIt;
typedef WValue::ConstValueIterator VCIt;
typedef WValue::ValueIterator VIt;
typedef GenericStringBuffer<UTF16<> > WStringBuffer;
typedef PrettyWriter<WStringBuffer, UTF16<>, UTF16<>> WPrettyWriter;
typedef Writer<WStringBuffer, UTF16<>, UTF16<>> WWriter;
typedef GenericPointer<WValue> WPointer;
typedef GenericPointer<WCValue> 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);
}