xgboost
公共成员函数 | 静态公共成员函数 | 友元 | 所有成员列表
xgboost::Json 类参考

表示 JSON 格式的数据结构。 更多...

#include <json.h>

xgboost::Json 协作图
Collaboration graph

公共成员函数

 Json ()=default
 
 Json (JsonNumber number)
 
Jsonoperator= (JsonNumber number)
 
 Json (JsonInteger integer)
 
Jsonoperator= (JsonInteger integer)
 
 Json (JsonArray &&list)
 
Jsonoperator= (JsonArray &&array)
 
template<typename T , Value::ValueKind kind>
 Json (JsonTypedArray< T, kind > &&list)
 
template<typename T , Value::ValueKind kind>
Jsonoperator= (JsonTypedArray< T, kind > &&array)
 
 Json (JsonObject &&object)
 
Jsonoperator= (JsonObject &&object)
 
 Json (JsonString &&str)
 
Jsonoperator= (JsonString &&str)
 
 Json (JsonBoolean boolean)
 
Jsonoperator= (JsonBoolean boolean)
 
 Json (JsonNull null)
 
Jsonoperator= (JsonNull null)
 
 Json (Json const &other)=default
 
Jsonoperator= (Json const &other)=default
 
 Json (Json &&other) noexcept
 
Jsonoperator= (Json &&other) noexcept
 
Jsonoperator[] (std::string const &key) const
 使用 std::string 索引 Json 对象,用于 Json Object。 更多...
 
Jsonoperator[] (int ind) const
 使用 int 索引 Json 对象,用于 Json Array。 更多...
 
Value const & GetValue () const &
 返回存储的 Json 值的引用。 更多...
 
Value const & GetValue () &&
 
ValueGetValue () &
 
bool operator== (Json const &rhs) const
 
IntrusivePtr< Value > const & Ptr () const
 

静态公共成员函数

static Json Load (StringView str, std::ios::openmode mode=std::ios::in)
 解码 JSON 对象。可选参数 mode 用于选择文本或二进制 (ubjson) 输入。 更多...
 
static Json Load (JsonReader *reader)
 传入您自己的 JsonReader更多...
 
static void Dump (Json json, std::string *out, std::ios::openmode mode=std::ios::out)
 编码 JSON 对象。可选参数 mode 用于选择文本或二进制 (ubjson) 输出。 更多...
 
static void Dump (Json json, std::vector< char > *out, std::ios::openmode mode=std::ios::out)
 
static void Dump (Json json, JsonWriter *writer)
 使用您自己的 JsonWriter更多...
 
template<typename Container = std::string>
static Container Dump (Json json)
 

友元

std::ostream & operator<< (std::ostream &os, Json const &j)
 

详细描述

表示 JSON 格式的数据结构。

限制:UTF-8 支持不完善。ASCII 以外的码点无效。

示例

// 创建一个 JSON 对象。
Json object { Object() };
// 将键 "key" 赋值为 JSON 字符串 "Value";
object["key"] = String("Value");
// 将键 "arr" 赋值为空 JSON 数组;
object["arr"] = Array();
Json()=default
JsonObject Object
定义: json.h:604
JsonArray Array
定义: json.h:605
JsonString String
定义: json.h:609

构造函数与析构函数文档

◆ Json() [1/11]

xgboost::Json::Json ( )
default

◆ Json() [2/11]

xgboost::Json::Json ( JsonNumber  number)
inlineexplicit

◆ Json() [3/11]

xgboost::Json::Json ( JsonInteger  integer)
inlineexplicit

◆ Json() [4/11]

xgboost::Json::Json ( JsonArray &&  list)
inlineexplicit

◆ Json() [5/11]

template<typename T , Value::ValueKind kind>
xgboost::Json::Json ( JsonTypedArray< T, kind > &&  list)
inlineexplicit

◆ Json() [6/11]

xgboost::Json::Json ( JsonObject &&  object)
inlineexplicit

◆ Json() [7/11]

xgboost::Json::Json ( JsonString &&  str)
inlineexplicit

◆ Json() [8/11]

xgboost::Json::Json ( JsonBoolean  boolean)
inlineexplicit

◆ Json() [9/11]

xgboost::Json::Json ( JsonNull  null)
inlineexplicit

◆ Json() [10/11]

xgboost::Json::Json ( Json const &  other)
default

◆ Json() [11/11]

xgboost::Json::Json ( Json &&  other)
inlinenoexcept

成员函数文档

◆ Dump() [1/4]

template<typename Container = std::string>
static Container xgboost::Json::Dump ( Json  json)
inlinestatic

◆ Dump() [2/4]

static void xgboost::Json::Dump ( Json  json,
JsonWriter writer 
)
static

使用您自己的 JsonWriter

◆ Dump() [3/4]

static void xgboost::Json::Dump ( Json  json,
std::string *  out,
std::ios::openmode  mode = std::ios::out 
)
static

编码 JSON 对象。可选参数 mode 用于选择文本或二进制 (ubjson) 输出。

◆ Dump() [4/4]

static void xgboost::Json::Dump ( Json  json,
std::vector< char > *  out,
std::ios::openmode  mode = std::ios::out 
)
static

◆ GetValue() [1/3]

Value& xgboost::Json::GetValue ( ) &
inline

◆ GetValue() [2/3]

Value const& xgboost::Json::GetValue ( ) &&
inline

◆ GetValue() [3/3]

Value const& xgboost::Json::GetValue ( ) const &
inline

返回存储的 Json 值的引用。

◆ Load() [1/2]

static Json xgboost::Json::Load ( JsonReader reader)
static

传入您自己的 JsonReader

◆ Load() [2/2]

static Json xgboost::Json::Load ( StringView  str,
std::ios::openmode  mode = std::ios::in 
)
static

解码 JSON 对象。可选参数 mode 用于选择文本或二进制 (ubjson) 输入。

◆ operator=() [1/10]

Json& xgboost::Json::operator= ( Json &&  other)
inlinenoexcept

◆ operator=() [2/10]

Json& xgboost::Json::operator= ( Json const &  other)
default

◆ operator=() [3/10]

Json& xgboost::Json::operator= ( JsonArray &&  array)
inline

◆ operator=() [4/10]

Json& xgboost::Json::operator= ( JsonBoolean  boolean)
inline

◆ operator=() [5/10]

Json& xgboost::Json::operator= ( JsonInteger  integer)
inline

◆ operator=() [6/10]

Json& xgboost::Json::operator= ( JsonNull  null)
inline

◆ operator=() [7/10]

Json& xgboost::Json::operator= ( JsonNumber  number)
inline

◆ operator=() [8/10]

Json& xgboost::Json::operator= ( JsonObject &&  object)
inline

◆ operator=() [9/10]

Json& xgboost::Json::operator= ( JsonString &&  str)
inline

◆ operator=() [10/10]

template<typename T , Value::ValueKind kind>
Json& xgboost::Json::operator= ( JsonTypedArray< T, kind > &&  array)
inline

◆ operator==()

bool xgboost::Json::operator== ( Json const &  rhs) const
inline

◆ operator[]() [1/2]

Json& xgboost::Json::operator[] ( int  ind) const
inline

使用 int 索引 Json 对象,用于 Json Array。

◆ operator[]() [2/2]

Json& xgboost::Json::operator[] ( std::string const &  key) const
inline

使用 std::string 索引 Json 对象,用于 Json Object。

◆ Ptr()

IntrusivePtr<Value> const& xgboost::Json::Ptr ( ) const
inline

友元和相关函数文档

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
Json const &  j 
)
friend

此类的文档生成自以下文件