ChatPlexSDK-BS 1.0.1-v6.2.0
C++ ChatPlex BeatSaber SDK
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
CP_SDK::Utils::Json Class Reference

Json utils. More...

#include <Json.hpp>

Public Types

using UTF8 = rapidjson::UTF8< char >
 
using UTF16 = rapidjson::UTF16< char16_t >
 
using U16Value = rapidjson::GenericValue< UTF16 >
 
using U16Document = rapidjson::GenericDocument< UTF16 >
 
using U8GenericStringBuffer = rapidjson::GenericStringBuffer< UTF8 >
 
using U16GenericStringBuffer = rapidjson::GenericStringBuffer< UTF16 >
 
template<typename t_Writter >
using U16Writter = rapidjson::Writer< t_Writter, UTF16, UTF16 >
 
template<typename t_Writter >
using U16ToU8Writter = rapidjson::Writer< t_Writter, UTF16, UTF8 >
 
template<typename t_Writter >
using U16PrettyWritter = rapidjson::PrettyWriter< t_Writter, UTF16, UTF16 >
 
template<typename t_Writter >
using U16ToU8PrettyWritter = rapidjson::PrettyWriter< t_Writter, UTF16, UTF8 >
 
using TAllocator = U16Document::AllocatorType
 

Static Public Member Functions

static bool TryFromU8String (std::string_view p_Str, U16Document &p_Document, std::u16string *p_Error=nullptr)
 Try parse from utf8 string.
 
static bool TryFromU8Stream (std::ifstream &p_Stream, U16Document &p_Document, std::u16string *p_Error=nullptr)
 Try parse from utf8 string.
 
static bool TryFromU16String (std::u16string_view p_Str, U16Document &p_Document, std::u16string *p_Error=nullptr)
 Try parse from utf8 string.
 
static std::string ToU8String (U16Value &p_Value, bool p_Pretty)
 Encode to utf8 string.
 
static bool TryToU8Stream (U16Value &p_Value, bool p_Pretty, std::ofstream &p_Stream)
 Encode to utf8 string.
 
static std::u16string ToU16String (U16Value &p_Value, bool p_Pretty)
 Encode to utf16 string.
 
static void SerializeBool (U16Value &p_Document, TAllocator &p_Allocator, bool p_Value, const char16_t *p_Name)
 
static void SerializeColor32 (U16Value &p_Document, TAllocator &p_Allocator, UnityEngine::Color32 p_Value, const char16_t *p_Name)
 
static void SerializeColor (U16Value &p_Document, TAllocator &p_Allocator, UnityEngine::Color p_Value, const char16_t *p_Name)
 
static void SerializeFloat (U16Value &p_Document, TAllocator &p_Allocator, float p_Value, const char16_t *p_Name)
 
static void SerializeInt32 (U16Value &p_Document, TAllocator &p_Allocator, int32_t p_Value, const char16_t *p_Name)
 
static void SerializeInt64 (U16Value &p_Document, TAllocator &p_Allocator, int64_t p_Value, const char16_t *p_Name)
 
static void SerializeQuaternion (U16Value &p_Document, TAllocator &p_Allocator, UnityEngine::Quaternion p_Value, const char16_t *p_Name)
 
static void SerializeString (U16Value &p_Document, TAllocator &p_Allocator, const std::u16string &p_Value, const char16_t *p_Name)
 
static void SerializeUInt32 (U16Value &p_Document, TAllocator &p_Allocator, uint32_t p_Value, const char16_t *p_Name)
 
static void SerializeUInt64 (U16Value &p_Document, TAllocator &p_Allocator, uint64_t p_Value, const char16_t *p_Name)
 
static void SerializeVector2 (U16Value &p_Document, TAllocator &p_Allocator, UnityEngine::Vector2 p_Value, const char16_t *p_Name)
 
static void SerializeVector3 (U16Value &p_Document, TAllocator &p_Allocator, UnityEngine::Vector3 p_Value, const char16_t *p_Name)
 
template<typename t_Enum >
static void SerializeEnum (U16Value &p_Document, TAllocator &p_Allocator, typename t_Enum::E p_Value, const char16_t *p_Name)
 
template<typename t_Object >
static void SerializeObject (U16Value &p_Document, TAllocator &p_Allocator, std::shared_ptr< t_Object > &p_Object, const char16_t *p_Name)
 
template<typename t_Object >
requires (!std::is_pointer_v<t_Object>)
static void SerializeObject (U16Value &p_Document, TAllocator &p_Allocator, std::optional< t_Object > &p_Object, const char16_t *p_Name)
 
template<typename t_Object >
static void SerializeObjectArray (U16Value &p_Document, TAllocator &p_Allocator, std::vector< std::shared_ptr< t_Object > > &p_Array, const char16_t *p_Name)
 
static void UnserializeBool (U16Value &p_Document, bool &p_Value, const char16_t *p_Name)
 
static void UnserializeColor32 (U16Value &p_Document, UnityEngine::Color32 &p_Value, const char16_t *p_Name)
 
static void UnserializeColor (U16Value &p_Document, UnityEngine::Color &p_Value, const char16_t *p_Name)
 
static void UnserializeFloat (U16Value &p_Document, float &p_Value, const char16_t *p_Name)
 
static void UnserializeInt32 (U16Value &p_Document, int32_t &p_Value, const char16_t *p_Name)
 
static void UnserializeInt64 (U16Value &p_Document, int64_t &p_Value, const char16_t *p_Name)
 
static void UnserializeQuaternion (U16Value &p_Document, UnityEngine::Quaternion &p_Value, const char16_t *p_Name)
 
static void UnserializeString (U16Value &p_Document, std::u16string &p_Value, const char16_t *p_Name)
 
static void UnserializeUInt32 (U16Value &p_Document, uint32_t &p_Value, const char16_t *p_Name)
 
static void UnserializeUInt64 (U16Value &p_Document, uint64_t &p_Value, const char16_t *p_Name)
 
static void UnserializeVector2 (U16Value &p_Document, UnityEngine::Vector2 &p_Value, const char16_t *p_Name)
 
static void UnserializeVector3 (U16Value &p_Document, UnityEngine::Vector3 &p_Value, const char16_t *p_Name)
 
template<typename t_Enum >
static void UnserializeEnum (U16Value &p_Document, typename t_Enum::E &p_Value, const char16_t *p_Name, typename t_Enum::E p_Default)
 
template<typename t_Object >
static void UnserializeObject (U16Value &p_Document, std::shared_ptr< t_Object > &p_Object, const char16_t *p_Name)
 
template<typename t_Object >
requires (!std::is_pointer_v<t_Object>)
static void UnserializeObject (U16Value &p_Document, std::optional< t_Object > &p_Object, const char16_t *p_Name)
 
template<typename t_Object >
static void UnserializeObjectArray (U16Value &p_Document, std::vector< std::shared_ptr< t_Object > > &p_Array, const char16_t *p_Name)
 

Detailed Description

Json utils.

Definition at line 67 of file Json.hpp.

Member Typedef Documentation

◆ TAllocator

using CP_SDK::Utils::Json::TAllocator = U16Document::AllocatorType

Definition at line 84 of file Json.hpp.

◆ U16Document

using CP_SDK::Utils::Json::U16Document = rapidjson::GenericDocument<UTF16>

Definition at line 75 of file Json.hpp.

◆ U16GenericStringBuffer

using CP_SDK::Utils::Json::U16GenericStringBuffer = rapidjson::GenericStringBuffer<UTF16>

Definition at line 77 of file Json.hpp.

◆ U16PrettyWritter

template<typename t_Writter >
using CP_SDK::Utils::Json::U16PrettyWritter = rapidjson::PrettyWriter<t_Writter, UTF16, UTF16>

Definition at line 81 of file Json.hpp.

◆ U16ToU8PrettyWritter

template<typename t_Writter >
using CP_SDK::Utils::Json::U16ToU8PrettyWritter = rapidjson::PrettyWriter<t_Writter, UTF16, UTF8>

Definition at line 82 of file Json.hpp.

◆ U16ToU8Writter

template<typename t_Writter >
using CP_SDK::Utils::Json::U16ToU8Writter = rapidjson::Writer<t_Writter, UTF16, UTF8>

Definition at line 80 of file Json.hpp.

◆ U16Value

using CP_SDK::Utils::Json::U16Value = rapidjson::GenericValue<UTF16>

Definition at line 74 of file Json.hpp.

◆ U16Writter

template<typename t_Writter >
using CP_SDK::Utils::Json::U16Writter = rapidjson::Writer<t_Writter, UTF16, UTF16>

Definition at line 79 of file Json.hpp.

◆ U8GenericStringBuffer

using CP_SDK::Utils::Json::U8GenericStringBuffer = rapidjson::GenericStringBuffer<UTF8>

Definition at line 76 of file Json.hpp.

◆ UTF16

using CP_SDK::Utils::Json::UTF16 = rapidjson::UTF16<char16_t>

Definition at line 73 of file Json.hpp.

◆ UTF8

using CP_SDK::Utils::Json::UTF8 = rapidjson::UTF8<char>

Definition at line 72 of file Json.hpp.

Member Function Documentation

◆ SerializeEnum()

template<typename t_Enum >
static void CP_SDK::Utils::Json::SerializeEnum ( U16Value &  p_Document,
TAllocator &  p_Allocator,
typename t_Enum::E  p_Value,
const char16_t *  p_Name 
)
inlinestatic

Definition at line 139 of file Json.hpp.

◆ SerializeObject() [1/2]

template<typename t_Object >
requires (!std::is_pointer_v<t_Object>)
static void CP_SDK::Utils::Json::SerializeObject ( U16Value &  p_Document,
TAllocator &  p_Allocator,
std::optional< t_Object > &  p_Object,
const char16_t *  p_Name 
)
inlinestatic

Definition at line 161 of file Json.hpp.

◆ SerializeObject() [2/2]

template<typename t_Object >
static void CP_SDK::Utils::Json::SerializeObject ( U16Value &  p_Document,
TAllocator &  p_Allocator,
std::shared_ptr< t_Object > &  p_Object,
const char16_t *  p_Name 
)
inlinestatic

Definition at line 148 of file Json.hpp.

◆ SerializeObjectArray()

template<typename t_Object >
static void CP_SDK::Utils::Json::SerializeObjectArray ( U16Value &  p_Document,
TAllocator &  p_Allocator,
std::vector< std::shared_ptr< t_Object > > &  p_Array,
const char16_t *  p_Name 
)
inlinestatic

Definition at line 176 of file Json.hpp.

◆ ToU16String()

static std::u16string CP_SDK::Utils::Json::ToU16String ( U16Value &  p_Value,
bool  p_Pretty 
)
static

Encode to utf16 string.

Parameters
p_ValueSource Json
p_PrettyShould pretty format?
Returns
Encoded Json

◆ ToU8String()

static std::string CP_SDK::Utils::Json::ToU8String ( U16Value &  p_Value,
bool  p_Pretty 
)
static

Encode to utf8 string.

Parameters
p_ValueSource Json
p_PrettyShould pretty format?
Returns
Encoded Json

◆ TryFromU16String()

static bool CP_SDK::Utils::Json::TryFromU16String ( std::u16string_view  p_Str,
U16Document &  p_Document,
std::u16string *  p_Error = nullptr 
)
static

Try parse from utf8 string.

Parameters
p_StrInput string
p_DocumentTarget document
p_ErrorOUT OPTIONAL error
Returns
True or false

◆ TryFromU8Stream()

static bool CP_SDK::Utils::Json::TryFromU8Stream ( std::ifstream &  p_Stream,
U16Document &  p_Document,
std::u16string *  p_Error = nullptr 
)
static

Try parse from utf8 string.

Parameters
p_StrInput string
p_DocumentTarget document
p_ErrorOUT OPTIONAL error
Returns
True or false

◆ TryFromU8String()

static bool CP_SDK::Utils::Json::TryFromU8String ( std::string_view  p_Str,
U16Document &  p_Document,
std::u16string *  p_Error = nullptr 
)
static

Try parse from utf8 string.

Parameters
p_StrInput string
p_DocumentTarget document
p_ErrorOUT OPTIONAL error
Returns
True or false

◆ TryToU8Stream()

static bool CP_SDK::Utils::Json::TryToU8Stream ( U16Value &  p_Value,
bool  p_Pretty,
std::ofstream &  p_Stream 
)
static

Encode to utf8 string.

Parameters
p_ValueSource Json
p_PrettyShould pretty format?
p_StreamTarget stream
Returns
Encoded Json

◆ UnserializeEnum()

template<typename t_Enum >
static void CP_SDK::Utils::Json::UnserializeEnum ( U16Value &  p_Document,
typename t_Enum::E &  p_Value,
const char16_t *  p_Name,
typename t_Enum::E  p_Default 
)
inlinestatic

Definition at line 210 of file Json.hpp.

◆ UnserializeObject() [1/2]

template<typename t_Object >
requires (!std::is_pointer_v<t_Object>)
static void CP_SDK::Utils::Json::UnserializeObject ( U16Value &  p_Document,
std::optional< t_Object > &  p_Object,
const char16_t *  p_Name 
)
inlinestatic

Definition at line 241 of file Json.hpp.

◆ UnserializeObject() [2/2]

template<typename t_Object >
static void CP_SDK::Utils::Json::UnserializeObject ( U16Value &  p_Document,
std::shared_ptr< t_Object > &  p_Object,
const char16_t *  p_Name 
)
inlinestatic

Definition at line 226 of file Json.hpp.

◆ UnserializeObjectArray()

template<typename t_Object >
static void CP_SDK::Utils::Json::UnserializeObjectArray ( U16Value &  p_Document,
std::vector< std::shared_ptr< t_Object > > &  p_Array,
const char16_t *  p_Name 
)
inlinestatic

Definition at line 259 of file Json.hpp.


The documentation for this class was generated from the following file: