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 对象。更多...
 
Jsonoperator[] (int ind) const
 使用 int 索引 Json 对象,用于 Json 数组。更多...
 
Value const & GetValue () const &
 返回存储的 Json 值的引用。更多...
 
Value const & GetValue () &&
 
GetValue () &
 
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 对象
定义: json.h:618
JsonArray 数组
定义: json.h:619
JsonString 字符串
定义: json.h:623

构造函数和析构函数文档

◆ Json() [1/11]

xgboost::Json::Json ( )
默认

◆ Json() [2/11]

xgboost::Json::Json ( JsonNumber  数字)
内联显式

◆ Json() [3/11]

xgboost::Json::Json ( JsonInteger  整数)
内联显式

◆ Json() [4/11]

xgboost::Json::Json ( JsonArray &&  列表)
内联显式

◆ Json() [5/11]

template<typename T , Value::ValueKind kind>
xgboost::Json::Json ( JsonTypedArray< T, kind > &&  列表)
内联显式

◆ Json() [6/11]

xgboost::Json::Json ( JsonObject &&  对象)
内联显式

◆ Json() [7/11]

xgboost::Json::Json ( JsonString &&  字符串)
内联显式

◆ Json() [8/11]

xgboost::Json::Json ( JsonBoolean  布尔值)
内联显式

◆ Json() [9/11]

xgboost::Json::Json ( JsonNull  空值)
内联显式

◆ Json() [10/11]

xgboost::Json::Json ( Json const &  其他)
默认

◆ Json() [11/11]

xgboost::Json::Json ( Json &&  其他)
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 写入器 
)
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 读取器)
static

传入您自己的 JsonReader

◆ Load() [2/2]

static Json xgboost::Json::Load ( StringView  字符串,
std::ios::openmode  mode = std::ios::in 
)
static

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

◆ operator=() [1/10]

Json& xgboost::Json::operator= ( Json &&  其他)
inlinenoexcept

◆ operator=() [2/10]

Json& xgboost::Json::operator= ( Json const &  其他)
默认

◆ operator=() [3/10]

Json& xgboost::Json::operator= ( JsonArray &&  数组)
inline

◆ operator=() [4/10]

Json& xgboost::Json::operator= ( JsonBoolean  布尔值)
inline

◆ operator=() [5/10]

Json& xgboost::Json::operator= ( JsonInteger  整数)
inline

◆ operator=() [6/10]

Json& xgboost::Json::operator= ( JsonNull  空值)
inline

◆ operator=() [7/10]

Json& xgboost::Json::operator= ( JsonNumber  数字)
inline

◆ operator=() [8/10]

Json& xgboost::Json::operator= ( JsonObject &&  对象)
inline

◆ operator=() [9/10]

Json& xgboost::Json::operator= ( JsonString &&  字符串)
inline

◆ operator=() [10/10]

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

◆ operator==()

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

◆ operator[]() [1/2]

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

使用 int 索引 Json 对象,用于 Json 数组。

◆ operator[]() [2/2]

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

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

◆ Ptr()

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

友元和相关函数文档

◆ operator<<

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

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