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

Public Member Functions

 Tileson (std::unique_ptr< tson::IJson > jsonParser=std::make_unique< tson::Json11 >(), bool includeBase64Decoder=true)
 
 Tileson (tson::Project *project, std::unique_ptr< tson::IJson > jsonParser=std::make_unique< tson::Json11 >(), bool includeBase64Decoder=true)
 
tson::DecompressorContainerdecompressors ()
 
std::unique_ptr< tson::Mapparse (const fs::path &path, std::unique_ptr< IDecompressor< std::vector< uint8_t >, std::vector< uint8_t > > > decompressor=nullptr)
 
std::unique_ptr< tson::Mapparse (const void *data, size_t size, std::unique_ptr< IDecompressor< std::vector< uint8_t >, std::vector< uint8_t > > > decompressor=nullptr)
 

Private Member Functions

std::unique_ptr< tson::MapparseJson ()
 

Private Attributes

tson::DecompressorContainer m_decompressors
 
std::unique_ptr< tson::IJsonm_json
 
tson::Projectm_project {nullptr}
 

Constructor & Destructor Documentation

◆ Tileson()

tson::Tileson::Tileson ( std::unique_ptr< tson::IJson jsonParser = std::make_unique<tson::Json11>(),
bool  includeBase64Decoder = true 
)
inlineexplicit
Parameters
includeBase64DecoderIncludes the base64-decoder from "Base64Decompressor.hpp" if true. Otherwise no other decompressors/decoders than whatever the user itself have added will be used.

Member Function Documentation

◆ decompressors()

tson::DecompressorContainer * tson::Tileson::decompressors ( )
inline

Gets the decompressor container used when something is either encoded or compressed (regardless: IDecompressor is used as base). These are used specifically for tile layers, and are connected by checking the name of the IDecompressor. If the name of a decompressor matches with an encoding or a compression, its decompress() function will be used.

Returns
The container including all decompressors.

◆ parse() [1/2]

std::unique_ptr< tson::Map > tson::Tileson::parse ( const fs::path &  path,
std::unique_ptr< IDecompressor< std::vector< uint8_t >, std::vector< uint8_t > > >  decompressor = nullptr 
)
inline

Parses Tiled json map data by file

Parameters
pathpath to file
Returns
parsed data as Map

◆ parse() [2/2]

std::unique_ptr< tson::Map > tson::Tileson::parse ( const void *  data,
size_t  size,
std::unique_ptr< IDecompressor< std::vector< uint8_t >, std::vector< uint8_t > > >  decompressor = nullptr 
)
inline

Parses Tiled json map data by memory

Parameters
dataThe data to parse
sizeThe size of the data to parse
Returns
parsed data as Map

◆ parseJson()

std::unique_ptr< tson::Map > tson::Tileson::parseJson ( )
inlineprivate

Common parsing functionality for doing the json parsing

Parameters
jsonTiled json to parse
Returns
parsed data as Map

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