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

#include <Property.hpp>

Public Member Functions

 Property ()
 
 Property (IJson &json, tson::Project *project=nullptr)
 
 Property (std::string name, std::any value, Type type)
 
void setValue (const std::any &value)
 
void setStrValue (const std::string &value)
 
void setName (const std::string &name)
 
const std::type_info & getValueType () const
 
std::string getValueTypeInfo ()
 
const std::any & getValue () const
 
template<typename T >
getValue () const
 
const std::string & getName () const
 
Type getType () const
 
const std::string & getPropertyType () const
 
void setValueByType (IJson &json)
 

Protected Member Functions

void setTypeByString (const std::string &str)
 

Protected Attributes

tson::Projectm_project = nullptr
 
Type m_type = Type::Undefined
 
std::string m_name {}
 
std::string m_propertyType {}
 
std::any m_value
 

Constructor & Destructor Documentation

◆ Property() [1/3]

tson::Property::Property ( )
inline

◆ Property() [2/3]

tson::Property::Property ( IJson json,
tson::Project project = nullptr 
)
inlineexplicit

◆ Property() [3/3]

tson::Property::Property ( std::string  name,
std::any  value,
Type  type 
)
inline

Member Function Documentation

◆ getName()

const std::string & tson::Property::getName ( ) const
inline

◆ getPropertyType()

const std::string & tson::Property::getPropertyType ( ) const
inline

◆ getType()

tson::Type tson::Property::getType ( ) const
inline

◆ getValue() [1/2]

const std::any & tson::Property::getValue ( ) const
inline

◆ getValue() [2/2]

template<typename T >
T tson::Property::getValue ( ) const
inline

◆ getValueType()

const std::type_info & tson::Property::getValueType ( ) const
inline

Gets the value type as std::value_info. This can easily be compared to types like this: Check if int: getValueType() == typeid(int)

Returns

◆ getValueTypeInfo()

std::string tson::Property::getValueTypeInfo ( )
inline

Gets the value type as std::string Examples of known types: "i" = int "f" = float "b" = bool

Returns

◆ setName()

void tson::Property::setName ( const std::string &  name)
inline

◆ setStrValue()

void tson::Property::setStrValue ( const std::string &  value)
inline

Sets the value specifically as string. When not specified as std::string, the default is that the value will be set as char * when adding a value like "test" This function is to make sure the value is added as string.

Parameters
value

◆ setTypeByString()

void tson::Property::setTypeByString ( const std::string &  str)
inlineprotected

◆ setValue()

void tson::Property::setValue ( const std::any &  value)
inline

◆ setValueByType()

void tson::Property::setValueByType ( IJson json)
inline

Member Data Documentation

◆ m_name

std::string tson::Property::m_name {}
protected

◆ m_project

tson::Project* tson::Property::m_project = nullptr
protected

◆ m_propertyType

std::string tson::Property::m_propertyType {}
protected

◆ m_type

Type tson::Property::m_type = Type::Undefined
protected

◆ m_value

std::any tson::Property::m_value
protected

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