Tileson 1.4.0
A helpful json parser for Tiled maps
Loading...
Searching...
No Matches
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
 
virtual std::unique_ptr< IJsoncreate ()=0
 
virtual ~IJson ()=default
 

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
 

Constructor & Destructor Documentation

◆ ~IJson()

virtual tson::IJson::~IJson ( )
virtualdefault

Pure virtual class needs virtual destructor so derived classes can call their own destructors

Member Function Documentation

◆ any()

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

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

◆ 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::Gason, and tson::Json11.

◆ array() [2/2]

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

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

◆ at() [1/2]

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

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

◆ at() [2/2]

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

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

◆ count()

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

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

◆ create()

virtual std::unique_ptr< IJson > tson::IJson::create ( )
pure virtual

Create a new empty instance using the same engine

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

◆ 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::Gason, and tson::Json11.

◆ directory() [2/2]

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

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

◆ 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::Gason, and tson::Json11.

◆ getBool() [2/2]

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

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

◆ getDouble() [1/2]

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

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

◆ getDouble() [2/2]

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

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

◆ getFloat() [1/2]

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

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

◆ getFloat() [2/2]

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

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

◆ getInt32() [1/2]

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

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

◆ getInt32() [2/2]

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

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

◆ getInt64() [1/2]

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

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

◆ getInt64() [2/2]

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

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

◆ getString() [1/2]

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

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

◆ getString() [2/2]

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

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

◆ getUInt32() [1/2]

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

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

◆ getUInt32() [2/2]

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

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

◆ getUInt64() [1/2]

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

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

◆ getUInt64() [2/2]

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

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

◆ isArray()

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

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

◆ isNull()

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

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

◆ isObject()

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

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

◆ operator[]()

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

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

◆ parse() [1/2]

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

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

◆ parse() [2/2]

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

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

◆ 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::Gason, and tson::Json11.


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