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

#include <Tools.hpp>

Public Member Functions

 Tools ()=delete
 
 ~Tools ()=delete
 

Static Public Member Functions

static std::vector< uint8_t > Base64DecodedStringToBytes (std::string_view str)
 
static std::vector< uint32_t > BytesToUnsignedInts (const std::vector< uint8_t > &bytes)
 
static std::vector< std::string > SplitString (const std::string &s, char delim)
 
static bool Equal (float a, float b, float precision=8192.f)
 

Constructor & Destructor Documentation

◆ Tools()

tson::Tools::Tools ( )
delete

◆ ~Tools()

tson::Tools::~Tools ( )
delete

Member Function Documentation

◆ Base64DecodedStringToBytes()

std::vector< uint8_t > tson::Tools::Base64DecodedStringToBytes ( std::string_view  str)
inlinestatic

When you have decoded a Base64 string, you'll get a string representing bytes. This function turns them into actual bytes.

Parameters
str
Returns

◆ BytesToUnsignedInts()

std::vector< uint32_t > tson::Tools::BytesToUnsignedInts ( const std::vector< uint8_t > &  bytes)
inlinestatic

Converts bytes into unsigned int values. The bytes are converted in the Little Endian byte order to fit Tiled's specs.

Parameters
bytesA vector of bytes.
Returns
Bytes converted to unsigned ints

◆ Equal()

bool tson::Tools::Equal ( float  a,
float  b,
float  precision = 8192.f 
)
inlinestatic

Uses a threshold for comparing floats, as they are not precise in many cases.

Parameters
a
b
Returns
true if equal based on the currently defined precision

◆ SplitString()

std::vector< std::string > tson::Tools::SplitString ( const std::string &  s,
char  delim 
)
inlinestatic

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