-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGpJsonUtilsInternal.hpp
More file actions
49 lines (37 loc) · 1.28 KB
/
GpJsonUtilsInternal.hpp
File metadata and controls
49 lines (37 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include <GpCore2/GpUtils/Types/Strings/GpStringOps.hpp>
#include <GpCore2/GpUtils/Types/Strings/GpUTF.hpp>
#include <GpCore2/GpUtils/Types/Strings/GpStringOps.hpp>
#include <GpCore2/GpUtils/Macro/GpMacroWarnings.hpp>
#include <string_view>
#define RAPIDJSON_ASSERT(X) ::GPlatform::VERIFY(X, "Json processing error"_sv);
GP_WARNING_PUSH()
#if defined(GP_COMPILER_CLANG) || defined(GP_COMPILER_GCC)
GP_WARNING_DISABLE(switch-enum)
#endif// #if defined(GP_COMPILER_CLANG) || defined(GP_COMPILER_GCC)
# include <rapidjson/document.h>
GP_WARNING_POP()
namespace GPlatform {
inline std::string_view _JsonValue2SV (const rapidjson::Document::GenericValue& aJsonValue)
{
return std::string_view(aJsonValue.GetString(), aJsonValue.GetStringLength());
}
inline std::string_view _JsonValue2SV (const rapidjson::Document::GenericValue* aJsonValue)
{
return std::string_view(aJsonValue->GetString(), aJsonValue->GetStringLength());
}
inline void _JsonSetStr
(
rapidjson::Value& aObj,
std::string_view aValue,
rapidjson::Document::AllocatorType& aJsonAllocator
)
{
aObj.SetString
(
std::data(aValue),
NumOps::SConvert<rapidjson::SizeType>(std::size(aValue)),
aJsonAllocator
);
}
}// namespace GPlatform