|
Botcraft 1.21.10
|
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant directly so we can better control which constructors are allowed. More...
#include <Json.hpp>
Public Member Functions | |
| Value (std::nullptr_t=nullptr) | |
| Value (std::string_view s) | |
| Value (const std::string &s) | |
| Value (std::string &&s) | |
| Value (const char *s) | |
| Value (const bool b) | |
| Value (const Object &o) | |
| Value (Object &&o) | |
| Value (const Array &a) | |
| Value (Array &&a) | |
| Value (const std::initializer_list< Value > &init) | |
| Value (const NetworkType &o) | |
| template<template< typename, typename > class C, typename T , typename A = T, std::enable_if_t< std::is_convertible_v< T, Value >, bool > = true> | |
| Value (const C< T, std::allocator< A > > &c) | |
| template<typename T , size_t N, std::enable_if_t< std::is_convertible_v< T, Value >, bool > = true> | |
| Value (const std::array< T, N > &v) | |
| template<typename T , std::enable_if_t< std::is_convertible_v< T, Value >, bool > = true> | |
| Value (const std::map< std::string, T > &m) | |
| template<typename T , std::enable_if_t< std::is_integral_v< T > &&std::is_unsigned_v< T >, bool > = true> | |
| Value (const T u) | |
| template<typename T , std::enable_if_t<(std::is_integral_v< T > &&std::is_signed_v< T >)||std::is_enum_v< T >, bool > = true> | |
| Value (const T i) | |
| template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true> | |
| Value (const T f) | |
| template<typename T , std::enable_if_t<!std::is_same_v< T, std::monostate > &&!std::is_same_v< T, Object > &&!std::is_same_v< T, Array > &&!std::is_same_v< T, std::string >, bool > = true> | |
| T | get () const |
| template<typename T = double, std::enable_if_t< std::is_integral_v< T >||std::is_floating_point_v< T >, bool > = true> | |
| T | get_number () const |
| template<typename T , std::enable_if_t< std::is_same_v< T, Object >||std::is_same_v< T, Array >||std::is_same_v< T, std::string >, bool > = true> | |
| T & | get () |
| template<typename T , std::enable_if_t< std::is_same_v< T, Object >||std::is_same_v< T, Array >||std::is_same_v< T, std::string >, bool > = true> | |
| const T & | get () const |
| Object & | get_object () |
| Array & | get_array () |
| std::string & | get_string () |
| const Object & | get_object () const |
| const Array & | get_array () const |
| const std::string & | get_string () const |
| template<typename T > | |
| bool | is () const |
| bool | is_null () const |
| bool | is_string () const |
| bool | is_object () const |
| bool | is_array () const |
| bool | is_bool () const |
| bool | is_integer () const |
| bool | is_number () const |
| Value & | operator[] (const std::string &s) |
| const Value & | operator[] (const std::string &s) const |
| Value & | operator[] (const size_t i) |
| const Value & | operator[] (const size_t i) const |
| bool | contains (const std::string &s) const |
| size_t | size () const |
| void | push_back (const Value &value) |
| void | push_back (Value &&value) |
| std::string | Dump (const int indent=-1, const char indent_char=' ') const |
| public dump interface | |
Private Member Functions | |
| std::string | Dump (const size_t depth_level, const int indent, const char indent_char) const |
| private dump interface | |
Private Attributes | |
| Internal::JsonVariant | val |
Friends | |
| std::istream & | operator>> (std::istream &is, Value &v) |
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant directly so we can better control which constructors are allowed.
| ProtocolCraft::Json::Value::Value | ( | std::nullptr_t | = nullptr | ) |
| ProtocolCraft::Json::Value::Value | ( | const std::initializer_list< Value > & | init | ) |
| ProtocolCraft::Json::Value::Value | ( | const NetworkType & | o | ) |
| ProtocolCraft::Json::Value::Value | ( | const C< T, std::allocator< A > > & | c | ) |
Definition at line 217 of file Json.hpp.
References push_back().
| ProtocolCraft::Json::Value::Value | ( | const std::array< T, N > & | v | ) |
Definition at line 230 of file Json.hpp.
References push_back().
| ProtocolCraft::Json::Value::Value | ( | const std::map< std::string, T > & | m | ) |
Definition at line 242 of file Json.hpp.
References operator[]().
| ProtocolCraft::Json::Value::Value | ( | const T | u | ) |
| ProtocolCraft::Json::Value::Value | ( | const T | i | ) |
| ProtocolCraft::Json::Value::Value | ( | const T | f | ) |
| bool ProtocolCraft::Json::Value::contains | ( | const std::string & | s | ) | const |
Definition at line 232 of file Json.cpp.
Referenced by Botcraft::Authentifier::AuthMicrosoft(), Botcraft::Blockstate::Blockstate(), Botcraft::Authentifier::GetCachedAccountOrDefault(), Botcraft::Authentifier::GetMCProfile(), Botcraft::Authentifier::GetMCToken(), Botcraft::Authentifier::GetMSAToken(), Botcraft::Authentifier::GetPlayerCertificates(), Botcraft::Authentifier::GetXBLToken(), Botcraft::Authentifier::GetXSTSToken(), Botcraft::AssetsManager::LoadBlocksFile(), Botcraft::Model::Model(), Botcraft::ModelModificationFromJson(), Botcraft::Authentifier::MSAAuthDeviceFlow(), Botcraft::Renderer::RecursiveRenderBlackboardJsonNode(), Botcraft::Renderer::RecursiveUpdateTimerBlackboardJsonNode(), and Botcraft::WeightFromJson().
| std::string ProtocolCraft::Json::Value::Dump | ( | const int | indent = -1, |
| const char | indent_char = ' ' |
||
| ) | const |
public dump interface
| indent | number of char (space) for indentation. If -1, no new line will be added between values |
| indent_char | char used for indentation |
Definition at line 287 of file Json.cpp.
References Dump().
Referenced by Dump(), Botcraft::Authentifier::GetMCToken(), Botcraft::Authentifier::GetMSAToken(), Botcraft::Authentifier::GetPlayerCertificates(), Botcraft::Authentifier::GetXBLToken(), Botcraft::Authentifier::GetXSTSToken(), Botcraft::ConnectionClient::Handle(), Botcraft::ConnectionClient::Handle(), Botcraft::Authentifier::JoinServer(), Botcraft::Authentifier::MSAAuthDeviceFlow(), and Botcraft::Authentifier::WriteCacheFile().
|
private |
private dump interface
| depth_level | depth of this Value in the tree |
| indent | number of char (space) for indentation |
| indent_char | char used for indentation |
Definition at line 292 of file Json.cpp.
References ProtocolCraft::Json::EscapeChars(), and val.
| T ProtocolCraft::Json::Value::get | ( | ) | const |
Definition at line 281 of file Json.hpp.
References val.
Referenced by get(), get(), Botcraft::Blockstate::GetBoolFromCondition(), Botcraft::Authentifier::GetMCToken(), Botcraft::Authentifier::GetMSAToken(), Botcraft::AssetsManager::LoadBlocksFile(), Botcraft::Model::Model(), Botcraft::ModelModificationFromJson(), Botcraft::Authentifier::MSAAuthDeviceFlow(), and ProtocolCraft::NBT::Tag::SerializeImpl().
| Array & ProtocolCraft::Json::Value::get_array | ( | ) |
Definition at line 114 of file Json.cpp.
Referenced by Botcraft::Blockstate::Blockstate(), Botcraft::AssetsManager::LoadBiomesFile(), Botcraft::AssetsManager::LoadBlocksFile(), and Botcraft::Model::Model().
| const Array & ProtocolCraft::Json::Value::get_array | ( | ) | const |
| T ProtocolCraft::Json::Value::get_number | ( | ) | const |
Definition at line 310 of file Json.hpp.
References val.
Referenced by Botcraft::ModelModificationFromJson(), Botcraft::Authentifier::MSAAuthDeviceFlow(), and Botcraft::WeightFromJson().
| Object & ProtocolCraft::Json::Value::get_object | ( | ) |
Definition at line 109 of file Json.cpp.
Referenced by Botcraft::Blockstate::Blockstate(), Botcraft::Authentifier::GetMCProfile(), Botcraft::Authentifier::GetMCToken(), Botcraft::Authentifier::GetMSAToken(), Botcraft::AssetsManager::LoadBlocksFile(), Botcraft::AssetsManager::LoadItemsFile(), Botcraft::Model::Model(), Botcraft::Renderer::RecursiveRenderBlackboardJsonNode(), Botcraft::Renderer::RecursiveUpdateTimerBlackboardJsonNode(), and Botcraft::Renderer::BehaviourRenderer::RemoveBlackboardValue().
| const Object & ProtocolCraft::Json::Value::get_object | ( | ) | const |
| std::string & ProtocolCraft::Json::Value::get_string | ( | ) |
Definition at line 119 of file Json.cpp.
Referenced by Botcraft::Authentifier::AuthMicrosoft(), Botcraft::Blockstate::GetBoolFromCondition(), Botcraft::Authentifier::GetMCProfile(), Botcraft::Authentifier::GetMCToken(), Botcraft::Authentifier::GetMSAToken(), Botcraft::Authentifier::GetPlayerCertificates(), Botcraft::Authentifier::GetXBLToken(), Botcraft::Authentifier::GetXSTSToken(), Botcraft::AssetsManager::LoadBlocksFile(), Botcraft::Model::Model(), Botcraft::ModelNameFromJson(), Botcraft::Authentifier::MSAAuthDeviceFlow(), and ProtocolCraft::Json::ParseObject().
| const std::string & ProtocolCraft::Json::Value::get_string | ( | ) | const |
| bool ProtocolCraft::Json::Value::is | ( | ) | const |
| bool ProtocolCraft::Json::Value::is_array | ( | ) | const |
Definition at line 154 of file Json.cpp.
Referenced by Botcraft::Blockstate::Blockstate(), Botcraft::Authentifier::GetXSTSToken(), Botcraft::AssetsManager::LoadBiomesFile(), and Botcraft::AssetsManager::LoadBlocksFile().
| bool ProtocolCraft::Json::Value::is_bool | ( | ) | const |
Definition at line 159 of file Json.cpp.
Referenced by Botcraft::Blockstate::GetBoolFromCondition().
| bool ProtocolCraft::Json::Value::is_integer | ( | ) | const |
| bool ProtocolCraft::Json::Value::is_null | ( | ) | const |
Definition at line 139 of file Json.cpp.
Referenced by Botcraft::Blockstate::Blockstate().
| bool ProtocolCraft::Json::Value::is_number | ( | ) | const |
Definition at line 170 of file Json.cpp.
References val.
Referenced by Botcraft::Authentifier::AuthMicrosoft(), and Botcraft::Authentifier::GetMSAToken().
| bool ProtocolCraft::Json::Value::is_object | ( | ) | const |
Definition at line 149 of file Json.cpp.
Referenced by Botcraft::Blockstate::Blockstate(), Botcraft::Authentifier::GetCachedAccountOrDefault(), Botcraft::Authentifier::GetMSAToken(), and Botcraft::AssetsManager::LoadBlocksFile().
| bool ProtocolCraft::Json::Value::is_string | ( | ) | const |
Definition at line 144 of file Json.cpp.
Referenced by Botcraft::Authentifier::AuthMicrosoft(), Botcraft::Blockstate::GetBoolFromCondition(), and Botcraft::Authentifier::GetMSAToken().
| Value & ProtocolCraft::Json::Value::operator[] | ( | const size_t | i | ) |
| const Value & ProtocolCraft::Json::Value::operator[] | ( | const size_t | i | ) | const |
| Value & ProtocolCraft::Json::Value::operator[] | ( | const std::string & | s | ) |
| const Value & ProtocolCraft::Json::Value::operator[] | ( | const std::string & | s | ) | const |
| void ProtocolCraft::Json::Value::push_back | ( | const Value & | value | ) |
Definition at line 257 of file Json.cpp.
References val.
Referenced by Botcraft::Blockstate::Blockstate(), ProtocolCraft::Components::HashedDataComponentPatch::HashedDataComponentPatch(), Botcraft::DNSMessage::SerializeImpl(), ProtocolCraft::Components::DataComponentPredicate::SerializeImpl(), ProtocolCraft::Components::DataComponentPatch::SerializeImpl(), ProtocolCraft::NBT::TagList::SerializeImpl(), Value(), and Value().
| void ProtocolCraft::Json::Value::push_back | ( | Value && | value | ) |
| size_t ProtocolCraft::Json::Value::size | ( | ) | const |
Definition at line 237 of file Json.cpp.
References val.
Referenced by Botcraft::Authentifier::GetCachedAccountOrDefault(), Botcraft::Authentifier::GetXSTSToken(), and Botcraft::AssetsManager::LoadBlocksFile().
|
friend |
|
private |
Definition at line 175 of file Json.hpp.
Referenced by Dump(), get(), get(), get_number(), is(), is_integer(), is_number(), operator[](), operator[](), operator[](), operator[](), push_back(), push_back(), size(), and Value().