Lysa  0.0
Lysa 3D Engine
JsonDocument Class Reference

Detailed Description

A JSON document, owner of the values tree.

Public Member Functions

 JsonDocument ()
 
 ~JsonDocument ()
 
 JsonDocument (JsonDocument &&other) noexcept
 
JsonDocument & operator= (JsonDocument &&other) noexcept
 
 JsonDocument (const JsonDocument &) = delete
 
JsonDocument & operator= (const JsonDocument &) = delete
 
void save (const std::string &uri, int indent=4) const
 
void save (const VirtualFS &fs, const std::string &uri, int indent=4) const
 
std::string dump (int indent=4) const
 
JsonValue getRoot () const &
 
JsonValue getRoot () const && = delete
 

Static Public Member Functions

static JsonDocument parse (const std::string &text)
 
static JsonDocument load (const std::string &uri)
 
static JsonDocument load (const VirtualFS &fs, const std::string &uri)
 

Constructor & Destructor Documentation

JsonDocument ( )
~JsonDocument ( )
JsonDocument ( JsonDocument &&  other)
noexcept
JsonDocument ( const JsonDocument &  )
delete

Member Function Documentation

std::string dump ( int  indent = 4) const

Returns the document as a JSON string

Parameters
indentNumber of spaces used to indent, -1 for the most compact form
JsonValue getRoot ( ) const &

Returns a read/write handle on the root value of the document

JsonValue getRoot ( ) const &&
delete
static JsonDocument load ( const std::string &  uri)
static

Loads and parses a document from a file

static JsonDocument load ( const VirtualFS fs,
const std::string &  uri 
)
static

Loads and parses a document from a file

Parameters
fsVirtual file system resolving the URI
uriURI of the JSON file
JsonDocument& operator= ( const JsonDocument &  )
delete
JsonDocument& operator= ( JsonDocument &&  other)
noexcept
static JsonDocument parse ( const std::string &  text)
static

Parses a document from a string

void save ( const std::string &  uri,
int  indent = 4 
) const

Writes the document into a file

Parameters
uriURI of the JSON file
indentNumber of spaces used to indent, -1 to write the most compact form
void save ( const VirtualFS fs,
const std::string &  uri,
int  indent = 4 
) const

Writes the document into a file

Parameters
fsVirtual file system resolving the URI
uriURI of the JSON file
indentNumber of spaces used to indent, -1 to write the most compact form