Tileson 1.4.0
A helpful json parser for Tiled maps
Loading...
Searching...
No Matches
Public Member Functions | List of all members
tson::World Class Reference

#include <World.hpp>

Public Member Functions

 World (std::unique_ptr< tson::IJson > jsonParser)
 
 World (const fs::path &path, std::unique_ptr< tson::IJson > jsonParser)
 
bool parse (const fs::path &path)
 
std::size_t loadMaps (tson::Tileson *parser)
 
bool contains (std::string_view filename)
 
const WorldMapDataget (std::string_view filename) const
 
const fs::path & getPath () const
 
const fs::path & getFolder () const
 
const std::vector< WorldMapData > & getMapData () const
 
bool onlyShowAdjacentMaps () const
 
const std::string & getType () const
 
const std::vector< std::unique_ptr< tson::Map > > & getMaps () const
 

Constructor & Destructor Documentation

◆ World() [1/2]

tson::World::World ( std::unique_ptr< tson::IJson jsonParser)
inlineexplicit

◆ World() [2/2]

tson::World::World ( const fs::path &  path,
std::unique_ptr< tson::IJson jsonParser 
)
inlineexplicit

Member Function Documentation

◆ contains()

bool tson::World::contains ( std::string_view  filename)
inline

Check if there is WorldMapData in the world that contains the current filename. Filename = <file>.<extension>

Parameters
filename
Returns

◆ get()

const WorldMapData * tson::World::get ( std::string_view  filename) const
inline

Get a map by its filename

Parameters
filenameFilename (including extension) - (example: file.json)
Returns
pointer to WorldMapData or nullptr if not exists

◆ getFolder()

const fs::path & tson::World::getFolder ( ) const
inline

◆ getMapData()

const std::vector< WorldMapData > & tson::World::getMapData ( ) const
inline

◆ getMaps()

const std::vector< std::unique_ptr< tson::Map > > & tson::World::getMaps ( ) const
inline

Get all maps that have been loaded by loadMaps(). NOTE: This is untested, and was a last second addition to Tileson 1.2.0, as I had forgot about the loadMaps() functionality (also untested) If you find anything malfunctioning - please report.

Returns
All maps loaded by loadMaps()

◆ getPath()

const fs::path & tson::World::getPath ( ) const
inline

◆ getType()

const std::string & tson::World::getType ( ) const
inline

◆ loadMaps()

std::size_t tson::World::loadMaps ( tson::Tileson parser)
inline

Loads the actual maps based on the world data.

Parameters
parserA Tileson object used for parsing the maps of the world.
Returns
How many maps who were parsed. Remember to call getStatus() for the actual map to find out if everything went okay.

◆ onlyShowAdjacentMaps()

bool tson::World::onlyShowAdjacentMaps ( ) const
inline

◆ parse()

bool tson::World::parse ( const fs::path &  path)
inline

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