Uranus  1.0.1.0
Uranus is a GameEngine written in C++
Loading...
Searching...
No Matches
tson::Json11 Class Reference
Inheritance diagram for tson::Json11:
[legend]
Collaboration diagram for tson::Json11:
[legend]

Public Member Functions

 Json11 (const json11::Json &json)
 
bool any (std::string_view key) const override
 
std::vector< std::unique_ptr< IJson > > array () override
 
std::vector< std::unique_ptr< IJson > > & array (std::string_view key) override
 
IJsonat (size_t pos) override
 
IJsonat (std::string_view key) override
 
size_t count (std::string_view key) const override
 
fs::path directory () const override
 
void directory (const fs::path &directory) override
 
bool isArray () const override
 
bool isNull () const override
 
bool isObject () const override
 
IJsonoperator[] (std::string_view key) override
 
bool parse (const fs::path &path) override
 
bool parse (const void *data, size_t size) override
 
size_t size () const override
 
- Public Member Functions inherited from tson::IJson
virtual ~IJson ()=default
 
virtual bool any (std::string_view key) const =0
 
virtual std::vector< std::unique_ptr< IJson > > array ()=0
 
virtual std::vector< std::unique_ptr< IJson > > & array (std::string_view key)=0
 
virtual IJsonat (size_t pos)=0
 
virtual IJsonat (std::string_view key)=0
 
virtual size_t count (std::string_view key) const =0
 
virtual fs::path directory () const =0
 
virtual void directory (const fs::path &directory)=0
 
template<typename T >
get ()
 
template<typename T >
get (std::string_view key)
 
virtual bool isArray () const =0
 
virtual bool isNull () const =0
 
virtual bool isObject () const =0
 
virtual IJsonoperator[] (std::string_view key)=0
 
virtual bool parse (const fs::path &path)=0
 
virtual bool parse (const void *data, size_t size)=0
 
virtual size_t size () const =0
 

Protected Member Functions

bool getBool () override
 
bool getBool (std::string_view key) override
 
double getDouble () override
 
double getDouble (std::string_view key) override
 
float getFloat () override
 
float getFloat (std::string_view key) override
 
int32_t getInt32 () override
 
int32_t getInt32 (std::string_view key) override
 
int64_t getInt64 () override
 
int64_t getInt64 (std::string_view key) override
 
std::string getString () override
 
std::string getString (std::string_view key) override
 
uint32_t getUInt32 () override
 
uint32_t getUInt32 (std::string_view key) override
 
uint64_t getUInt64 () override
 
uint64_t getUInt64 (std::string_view key) override
 
virtual bool getBool ()=0
 
virtual bool getBool (std::string_view key)=0
 
virtual double getDouble ()=0
 
virtual double getDouble (std::string_view key)=0
 
virtual float getFloat ()=0
 
virtual float getFloat (std::string_view key)=0
 
virtual int32_t getInt32 ()=0
 
virtual int32_t getInt32 (std::string_view key)=0
 
virtual int64_t getInt64 ()=0
 
virtual int64_t getInt64 (std::string_view key)=0
 
virtual std::string getString ()=0
 
virtual std::string getString (std::string_view key)=0
 
virtual uint32_t getUInt32 ()=0
 
virtual uint32_t getUInt32 (std::string_view key)=0
 
virtual uint64_t getUInt64 ()=0
 
virtual uint64_t getUInt64 (std::string_view key)=0
 

Private Member Functions

void clearCache ()
 

Private Attributes

std::map< std::string, std::unique_ptr< IJson > > m_arrayCache
 
std::map< std::string, std::vector< std::unique_ptr< IJson > > > m_arrayListDataCache
 
std::map< size_t, std::unique_ptr< IJson > > m_arrayPosCache
 
std::unique_ptr< json11::Jsonm_data = nullptr
 
const json11::Jsonm_json = nullptr
 
fs::path m_path
 

Member Function Documentation

◆ any()

bool tson::Json11::any ( std::string_view  key) const
inlineoverridevirtual

Implements tson::IJson.

◆ array() [1/2]

std::vector< std::unique_ptr< IJson > > tson::Json11::array ( )
inlineoverridevirtual

If current json object is an array, this will get all elements of it!

Returns
An array

Implements tson::IJson.

◆ array() [2/2]

std::vector< std::unique_ptr< IJson > > & tson::Json11::array ( std::string_view  key)
inlineoverridevirtual

Implements tson::IJson.

◆ at() [1/2]

IJson & tson::Json11::at ( size_t  pos)
inlineoverridevirtual

Implements tson::IJson.

◆ at() [2/2]

IJson & tson::Json11::at ( std::string_view  key)
inlineoverridevirtual

Implements tson::IJson.

◆ count()

size_t tson::Json11::count ( std::string_view  key) const
inlineoverridevirtual

Implements tson::IJson.

◆ directory() [1/2]

fs::path tson::Json11::directory ( ) const
inlineoverridevirtual

Get the directory where the json was loaded. Only assigned if json is parsed by file.

Returns

Implements tson::IJson.

◆ directory() [2/2]

void tson::Json11::directory ( const fs::path &  directory)
inlineoverridevirtual

Implements tson::IJson.

◆ getBool() [1/2]

bool tson::Json11::getBool ( )
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getBool() [2/2]

bool tson::Json11::getBool ( std::string_view  key)
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getDouble() [1/2]

double tson::Json11::getDouble ( )
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getDouble() [2/2]

double tson::Json11::getDouble ( std::string_view  key)
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getFloat() [1/2]

float tson::Json11::getFloat ( )
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getFloat() [2/2]

float tson::Json11::getFloat ( std::string_view  key)
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getInt32() [1/2]

int32_t tson::Json11::getInt32 ( )
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getInt32() [2/2]

int32_t tson::Json11::getInt32 ( std::string_view  key)
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getInt64() [1/2]

int64_t tson::Json11::getInt64 ( )
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getInt64() [2/2]

int64_t tson::Json11::getInt64 ( std::string_view  key)
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getString() [1/2]

std::string tson::Json11::getString ( )
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getString() [2/2]

std::string tson::Json11::getString ( std::string_view  key)
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getUInt32() [1/2]

uint32_t tson::Json11::getUInt32 ( )
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getUInt32() [2/2]

uint32_t tson::Json11::getUInt32 ( std::string_view  key)
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getUInt64() [1/2]

uint64_t tson::Json11::getUInt64 ( )
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ getUInt64() [2/2]

uint64_t tson::Json11::getUInt64 ( std::string_view  key)
inlineoverrideprotectedvirtual

Implements tson::IJson.

◆ isArray()

bool tson::Json11::isArray ( ) const
inlineoverridevirtual

Implements tson::IJson.

◆ isNull()

bool tson::Json11::isNull ( ) const
inlineoverridevirtual

Implements tson::IJson.

◆ isObject()

bool tson::Json11::isObject ( ) const
inlineoverridevirtual

Implements tson::IJson.

◆ operator[]()

IJson & tson::Json11::operator[] ( std::string_view  key)
inlineoverridevirtual

Implements tson::IJson.

◆ parse() [1/2]

bool tson::Json11::parse ( const fs::path &  path)
inlineoverridevirtual

Implements tson::IJson.

◆ parse() [2/2]

bool tson::Json11::parse ( const void *  data,
size_t  size 
)
inlineoverridevirtual

Implements tson::IJson.

◆ size()

size_t tson::Json11::size ( ) const
inlineoverridevirtual

Get the size of an object. This will be equal to the number of variables an object contains.

Returns

Implements tson::IJson.


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