Tileson 1.4.0
A helpful json parser for Tiled maps
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
tson Namespace Reference

Classes

class  Animation
 
class  Base64
 
class  Base64Decompressor
 
class  Chunk
 
class  Color
 
class  DecompressorContainer
 
struct  EnableBitMaskOperators
 
class  EnumDefinition
 
class  EnumValue
 
class  FlaggedTile
 
class  Frame
 
class  Gason
 
class  Grid
 
class  IDecompressor
 
class  IJson
 
class  Json11
 
class  Layer
 
class  Map
 
class  MemoryBuffer
 
class  MemoryStream
 
class  Object
 
class  Project
 
class  ProjectData
 
class  ProjectFolder
 
class  ProjectPropertyTypes
 
class  Property
 
class  PropertyCollection
 
class  Rect
 
class  Terrain
 
class  Text
 
class  Tile
 
class  TiledClass
 
class  TileObject
 
class  Tileset
 
class  Tileson
 
class  Tools
 
class  Transformations
 
class  Vector2
 
class  WangColor
 
class  WangSet
 
class  WangTile
 
class  World
 
class  WorldMapData
 

Typedefs

typedef Color< uint8_t > Colori
 
typedef Color< float > Colorf
 
typedef Vector2< int > Vector2i
 
typedef Vector2< float > Vector2f
 
using LinkedFileParser = std::function< std::unique_ptr< IJson >(std::string relativePath)>
 

Enumerations

enum class  Type : uint8_t {
  Undefined = 0 , Color = 1 , File = 2 , Int = 3 ,
  Boolean = 4 , Float = 5 , String = 6 , Class = 7 ,
  Enum = 8 , Object = 9
}
 
enum class  LayerType : uint8_t {
  Undefined = 0 , TileLayer = 1 , ObjectGroup = 2 , ImageLayer = 3 ,
  Group = 4
}
 
enum class  ParseStatus : uint8_t {
  OK = 0 , FileNotFound = 1 , ParseError = 2 , MissingData = 3 ,
  DecompressionError = 4
}
 
enum class  ObjectType : uint8_t {
  Undefined = 0 , Object = 1 , Ellipse = 2 , Rectangle = 3 ,
  Point = 4 , Polygon = 5 , Polyline = 6 , Text = 7 ,
  Template = 8
}
 
enum class  TileFlipFlags : uint32_t { None = 0 , Diagonally = FLIPPED_DIAGONALLY_FLAG , Vertically = FLIPPED_VERTICALLY_FLAG , Horizontally = FLIPPED_HORIZONTALLY_FLAG }
 
enum class  ObjectAlignment : uint8_t {
  Unspecified = 0 , TopLeft = 1 , Top = 2 , TopRight = 3 ,
  Left = 4 , Center = 5 , Right = 6 , BottomLeft = 7 ,
  Bottom = 8 , BottomRight = 9
}
 
enum class  TextAlignment : uint8_t {
  Unresolved = 0 , Left = 1 , Center = 2 , Right = 3 ,
  Justify = 4 , Top = 5 , Bottom = 6
}
 
enum class  TileRenderSize : uint8_t { Undefined = 0 , Tile = 1 , Grid = 2 }
 
enum class  FillMode : uint8_t { Undefined = 0 , Stretch = 1 , PreserveAspectFit = 2 }
 
enum class  EnumStorageType : uint8_t { Unspecified = 0 , Int = 1 , String = 2 }
 

Functions

template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator| (Enum lhs, Enum rhs)
 
template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator& (Enum lhs, Enum rhs)
 
template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator^ (Enum lhs, Enum rhs)
 
template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator~ (Enum rhs)
 
template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type & operator|= (Enum &lhs, Enum rhs)
 
template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type & operator&= (Enum &lhs, Enum rhs)
 
template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type & operator^= (Enum &lhs, Enum rhs)
 
IJsonreadField (const std::string &fieldName, IJson &main, IJson *templ=nullptr)
 
bool readField (Text &field, const std::string &fieldName, IJson &main, IJson *templ=nullptr)
 
bool readField (std::vector< Vector2i > &field, const std::string &fieldName, IJson &main, IJson *templ=nullptr)
 
template<typename T >
bool readField (T &field, const std::string &fieldName, IJson &main, IJson *templ=nullptr)
 
bool readVector (Vector2i &field, const std::string &fieldNameX, const std::string &fieldNameY, IJson &main, IJson *templ=nullptr)
 
void readProperties (tson::PropertyCollection &properties, IJson &json, tson::Map *map)
 
void readGid (uint32_t &gid, TileFlipFlags &flags, IJson &main, IJson *templ=nullptr)
 

Typedef Documentation

◆ Colorf

typedef Color<float> tson::Colorf

◆ Colori

typedef Color<uint8_t> tson::Colori

◆ LinkedFileParser

using tson::LinkedFileParser = typedef std::function<std::unique_ptr<IJson>(std::string relativePath)>

◆ Vector2f

typedef Vector2<float> tson::Vector2f

◆ Vector2i

typedef Vector2<int> tson::Vector2i

Enumeration Type Documentation

◆ EnumStorageType

enum class tson::EnumStorageType : uint8_t
strong
Enumerator
Unspecified 
Int 
String 

◆ FillMode

enum class tson::FillMode : uint8_t
strong

Tileset.hpp - FillMode - From Tiled v1.9

Enumerator
Undefined 
Stretch 
PreserveAspectFit 

◆ LayerType

enum class tson::LayerType : uint8_t
strong

Layer.hpp - LayerType //'type': tilelayer, objectgroup, imagelayer or group

Enumerator
Undefined 
TileLayer 
ObjectGroup 
ImageLayer 
Group 

◆ ObjectAlignment

enum class tson::ObjectAlignment : uint8_t
strong

Tileset.hpp - ObjectAlignment

Enumerator
Unspecified 
TopLeft 
Top 
TopRight 
Left 
Center 
Right 
BottomLeft 
Bottom 
BottomRight 

◆ ObjectType

enum class tson::ObjectType : uint8_t
strong

Object.hpp - ObjectType

Enumerator
Undefined 
Object 
Ellipse 
Rectangle 
Point 
Polygon 
Polyline 
Text 
Template 

◆ ParseStatus

enum class tson::ParseStatus : uint8_t
strong

Map.hpp - ParseStatus

Enumerator
OK 
FileNotFound 
ParseError 
MissingData 
DecompressionError 

◆ TextAlignment

enum class tson::TextAlignment : uint8_t
strong

Text.hpp - TextAlignment

Enumerator
Unresolved 
Left 
Center 
Right 
Justify 
Top 
Bottom 

◆ TileFlipFlags

enum class tson::TileFlipFlags : uint32_t
strong

Object.hpp - ObjectFlipFlags

Enumerator
None 
Diagonally 
Vertically 
Horizontally 

◆ TileRenderSize

enum class tson::TileRenderSize : uint8_t
strong

Tileset.hpp - TileRenderSize - From Tiled v1.9

Enumerator
Undefined 
Tile 
Grid 

◆ Type

enum class tson::Type : uint8_t
strong

Type used in Property.hpp

Enumerator
Undefined 
Color 
File 

color

Int 

file

Boolean 

int

Float 

bool

String 

float

Class 

string

Enum 

class

Object 

'string' or 'int' with a value in 'propertyType'

Function Documentation

◆ operator&()

template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type tson::operator& ( Enum  lhs,
Enum  rhs 
)

◆ operator&=()

template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type & tson::operator&= ( Enum lhs,
Enum  rhs 
)

◆ operator^()

template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type tson::operator^ ( Enum  lhs,
Enum  rhs 
)

◆ operator^=()

template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type & tson::operator^= ( Enum lhs,
Enum  rhs 
)

◆ operator|()

template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type tson::operator| ( Enum  lhs,
Enum  rhs 
)

◆ operator|=()

template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type & tson::operator|= ( Enum lhs,
Enum  rhs 
)

◆ operator~()

template<typename Enum >
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type tson::operator~ ( Enum  rhs)

◆ readField() [1/4]

tson::IJson * tson::readField ( const std::string &  fieldName,
IJson main,
IJson templ = nullptr 
)
inline

Returns the requested IJson object if it exists in the map file or in a related template file

Parameters
fieldNameThe name of the field to check
mainThe main json file being parsed
templThe template file json, if present, nullptr otherwise.
Returns
the requested json object if found in the main json file, otherwise if it is found in the template and nullptr if not found anywhere

◆ readField() [2/4]

bool tson::readField ( std::vector< Vector2i > &  field,
const std::string &  fieldName,
IJson main,
IJson templ = nullptr 
)
inline

Attempts to read a series of coordinates from main file or the template if not overriden

Parameters
fieldNameThe name of the field to check
mainThe main json file being parsed
templThe template file json, if present, nullptr otherwise.
Returns
true if the field was found and parsed in any of the objects, false otherwise

◆ readField() [3/4]

template<typename T >
bool tson::readField ( T &  field,
const std::string &  fieldName,
IJson main,
IJson templ = nullptr 
)

Attempts to read a field from main file or the template if not overriden

Parameters
fieldNameThe name of the field to check
mainThe main json file being parsed
templThe template file json, if present, nullptr otherwise.
Returns
true if the field was found and parsed in any of the objects, false otherwise

◆ readField() [4/4]

bool tson::readField ( Text field,
const std::string &  fieldName,
IJson main,
IJson templ = nullptr 
)
inline

Attempts to read a text field from main file or the template if not overriden

Parameters
fieldNameThe name of the field to check
mainThe main json file being parsed
templThe template file json, if present, nullptr otherwise.
Returns
true if the field was found and parsed in any of the objects, false otherwise

◆ readGid()

void tson::readGid ( uint32_t &  gid,
TileFlipFlags flags,
IJson main,
IJson templ = nullptr 
)
inline

Reads a gid, parsing flip-flags

Parameters
propertiesTarget Properties collection to fill
jsonjson node representing the map object
mapPointer to current map being parsed

Reads a gid, parsing flip-flags

Parameters
gidTarget gid to fill
flagsTarget flip flags to fill
mainThe main json file being parsed
templThe template file json, if present, nullptr otherwise.

◆ readProperties()

void tson::readProperties ( tson::PropertyCollection properties,
IJson json,
tson::Map map 
)
inline

Reads all custom properties from the given json node

Parameters
propertiesTarget Properties collection to fill
jsonjson node representing the map object
mapPointer to current map being parsed

◆ readVector()

bool tson::readVector ( Vector2i field,
const std::string &  fieldNameX,
const std::string &  fieldNameY,
IJson main,
IJson templ = nullptr 
)
inline

Attempts to read a vector from main file or the template if not overriden

Parameters
fieldTarget variable to fill
fieldNameXThe name of the field to check for the x part of the vector
fieldNameYThe name of the field to check for the y part of the vector
mainThe main json file being parsed
templThe template file json, if present, nullptr otherwise.
Returns
true if the field was found and parsed in any of the objects, false otherwise