Tileson  1.3.0
A helpful json parser for Tiled maps
Public Member Functions | Protected Member Functions | List of all members
tson::IJson Class Referenceabstract

#include <IJson.hpp>

Inheritance diagram for tson::IJson:
tson::Gason tson::Json11

Public Member Functions

virtual IJsonoperator[] (std::string_view key)=0
 
virtual IJsonat (std::string_view key)=0
 
virtual IJsonat (size_t pos)=0
 
virtual std::vector< std::unique_ptr< IJson > > array ()=0
 
virtual std::vector< std::unique_ptr< IJson > > & array (std::string_view key)=0
 
virtual size_t size () const =0
 
virtual bool parse (const fs::path &path)=0
 
virtual bool parse (const void *data, size_t size)=0
 
template<typename T >
get (std::string_view key)
 
template<typename T >
get ()
 
virtual size_t count (std::string_view key) const =0
 
virtual bool any (std::string_view key) const =0
 
virtual bool isArray () const =0
 
virtual bool isObject () const =0
 
virtual bool isNull () const =0
 
virtual fs::path directory () const =0
 
virtual void directory (const fs::path &directory)=0
 

Protected Member Functions

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

Member Function Documentation

◆ any()

virtual bool tson::IJson::any ( std::string_view  key) const
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ array() [1/2]

virtual std::vector<std::unique_ptr<IJson> > tson::IJson::array ( )
pure virtual

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

Returns
An array

Implemented in tson::Json11, and tson::Gason.

◆ array() [2/2]

virtual std::vector<std::unique_ptr<IJson> >& tson::IJson::array ( std::string_view  key)
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ at() [1/2]

virtual IJson& tson::IJson::at ( size_t  pos)
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ at() [2/2]

virtual IJson& tson::IJson::at ( std::string_view  key)
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ count()

virtual size_t tson::IJson::count ( std::string_view  key) const
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ directory() [1/2]

virtual fs::path tson::IJson::directory ( ) const
pure virtual

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

Returns

Implemented in tson::Json11, and tson::Gason.

◆ directory() [2/2]

virtual void tson::IJson::directory ( const fs::path &  directory)
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ get() [1/2]

template<typename T >
T tson::IJson::get

◆ get() [2/2]

template<typename T >
T tson::IJson::get ( std::string_view  key)

◆ getBool() [1/2]

virtual bool tson::IJson::getBool ( )
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getBool() [2/2]

virtual bool tson::IJson::getBool ( std::string_view  key)
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getDouble() [1/2]

virtual double tson::IJson::getDouble ( )
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getDouble() [2/2]

virtual double tson::IJson::getDouble ( std::string_view  key)
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getFloat() [1/2]

virtual float tson::IJson::getFloat ( )
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getFloat() [2/2]

virtual float tson::IJson::getFloat ( std::string_view  key)
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getInt32() [1/2]

virtual int32_t tson::IJson::getInt32 ( )
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getInt32() [2/2]

virtual int32_t tson::IJson::getInt32 ( std::string_view  key)
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getInt64() [1/2]

virtual int64_t tson::IJson::getInt64 ( )
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getInt64() [2/2]

virtual int64_t tson::IJson::getInt64 ( std::string_view  key)
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getString() [1/2]

virtual std::string tson::IJson::getString ( )
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getString() [2/2]

virtual std::string tson::IJson::getString ( std::string_view  key)
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getUInt32() [1/2]

virtual uint32_t tson::IJson::getUInt32 ( )
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getUInt32() [2/2]

virtual uint32_t tson::IJson::getUInt32 ( std::string_view  key)
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getUInt64() [1/2]

virtual uint64_t tson::IJson::getUInt64 ( )
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ getUInt64() [2/2]

virtual uint64_t tson::IJson::getUInt64 ( std::string_view  key)
protectedpure virtual

Implemented in tson::Json11, and tson::Gason.

◆ isArray()

virtual bool tson::IJson::isArray ( ) const
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ isNull()

virtual bool tson::IJson::isNull ( ) const
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ isObject()

virtual bool tson::IJson::isObject ( ) const
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ operator[]()

virtual IJson& tson::IJson::operator[] ( std::string_view  key)
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ parse() [1/2]

virtual bool tson::IJson::parse ( const fs::path &  path)
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ parse() [2/2]

virtual bool tson::IJson::parse ( const void *  data,
size_t  size 
)
pure virtual

Implemented in tson::Json11, and tson::Gason.

◆ size()

virtual size_t tson::IJson::size ( ) const
pure virtual

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

Returns

Implemented in tson::Json11, and tson::Gason.


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