xgboost
Public Member Functions | Static Public Member Functions | Friends | List of all members
xgboost::Json Class Reference

Data structure representing JSON format. More...

#include <json.h>

Collaboration diagram for xgboost::Json:
Collaboration graph

Public Member Functions

 Json ()
 
 Json (JsonNumber number)
 
Jsonoperator= (JsonNumber number)
 
 Json (JsonInteger integer)
 
Jsonoperator= (JsonInteger integer)
 
 Json (JsonArray list)
 
Jsonoperator= (JsonArray 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)
 
 Json (Json &&other)
 
Jsonoperator= (Json &&other)
 
Jsonoperator[] (std::string const &key) const
 Index Json object with a std::string, used for Json Object. More...
 
Jsonoperator[] (int ind) const
 Index Json object with int, used for Json Array. More...
 
Value const & GetValue () const &
 Return the reference to stored Json value. More...
 
Value const & GetValue () &&
 
ValueGetValue () &
 
bool operator== (Json const &rhs) const
 

Static Public Member Functions

static Json Load (StringView str)
 Load a Json object from string. More...
 
static Json Load (JsonReader *reader)
 Pass your own JsonReader. More...
 
static void Dump (Json json, std::string *out)
 

Friends

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

Detailed Description

Data structure representing JSON format.

Limitation: UTF-8 is not properly supported. Code points above ASCII are invalid.

Examples:

// Create a JSON object.
Json object { Object() };
// Assign key "key" with a JSON string "Value";
object["key"] = String("Value");
// Assign key "arr" with a empty JSON Array;
object["arr"] = Array();

Constructor & Destructor Documentation

◆ Json() [1/10]

xgboost::Json::Json ( )
inline

◆ Json() [2/10]

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

◆ Json() [3/10]

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

◆ Json() [4/10]

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

◆ Json() [5/10]

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

◆ Json() [6/10]

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

◆ Json() [7/10]

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

◆ Json() [8/10]

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

◆ Json() [9/10]

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

◆ Json() [10/10]

xgboost::Json::Json ( Json &&  other)
inline

Member Function Documentation

◆ Dump()

static void xgboost::Json::Dump ( Json  json,
std::string *  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

Return the reference to stored Json value.

◆ Load() [1/2]

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

Pass your own JsonReader.

◆ Load() [2/2]

static Json xgboost::Json::Load ( StringView  str)
static

Load a Json object from string.

◆ operator=() [1/9]

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

◆ operator=() [2/9]

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

◆ operator=() [3/9]

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

◆ operator=() [4/9]

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

◆ operator=() [5/9]

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

◆ operator=() [6/9]

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

◆ operator=() [7/9]

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

◆ operator=() [8/9]

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

◆ operator=() [9/9]

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

◆ operator==()

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

◆ operator[]() [1/2]

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

Index Json object with int, used for Json Array.

◆ operator[]() [2/2]

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

Index Json object with a std::string, used for Json Object.

Friends And Related Function Documentation

◆ operator<<

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

The documentation for this class was generated from the following file:
xgboost::Array
JsonArray Array
Definition: json.h:552
xgboost::String
JsonString String
Definition: json.h:556
xgboost::Object
JsonObject Object
Definition: json.h:551
xgboost::Json::Json
Json()
Definition: json.h:355