Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends
xgboost::Json Class Reference

Data structure representing JSON format. More...

#include <json.h>

Public Member Functions

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

Static Public Member Functions

static Json Load (StringView str, std::ios::openmode mode=std::ios::in)
 Decode the JSON object.
 
static Json Load (JsonReader *reader)
 Pass your own JsonReader.
 
static void Dump (Json json, std::string *out, std::ios::openmode mode=std::ios::out)
 Encode the JSON object.
 
static void Dump (Json json, std::vector< char > *out, std::ios::openmode mode=std::ios::out)
 
static void Dump (Json json, JsonWriter *writer)
 Use your own JsonWriter.
 

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();
Definition json.h:113
Definition json.h:190
Definition json.h:87
Data structure representing JSON format.
Definition json.h:357

Member Function Documentation

◆ Dump()

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

Encode the JSON object.

Optional parameter mode for choosing between text and binary (ubjson) output.

◆ Load()

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

Decode the JSON object.

Optional parameter mode for choosing between text and binary (ubjson) input.


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