5#ifndef TILESON_PROPERTY_HPP
6#define TILESON_PROPERTY_HPP
14#include "../common/Enums.hpp"
27 inline Property(std::string name, std::any value,
Type type);
29 inline void setValue(
const std::any &value);
31 inline void setName(
const std::string &name);
33 [[nodiscard]]
inline const std::type_info&
getValueType()
const;
35 [[nodiscard]]
inline const std::any &
getValue()
const;
38 [[nodiscard]]
inline const std::string &
getName()
const;
58 bool isCorrectType = (
m_value.type() ==
typeid(T));
62 T value = std::any_cast<T>(
m_value);
67 static T defaultValue;
81 if(json.
count(
"propertytype") > 0)
83 else if(json.
count(
"propertyType") > 0)
135 return m_value.type();
148 return m_value.type().name();
160 else if(str ==
"file")
162 else if(str ==
"int")
164 else if(str ==
"bool")
166 else if(str ==
"float")
168 else if(str ==
"string")
170 else if(str ==
"class")
172 else if(str ==
"object")
180 return m_propertyType;
T get(std::string_view key)
Definition IJson.hpp:82
virtual size_t count(std::string_view key) const =0
Definition Project.hpp:20
Definition Property.hpp:23
Property()
Definition Property.hpp:73
const std::string & getPropertyType() const
Definition Property.hpp:178
void setTypeByString(const std::string &str)
Definition Property.hpp:156
std::any m_value
Definition Property.hpp:52
void setValue(const std::any &value)
Definition Property.hpp:95
std::string getValueTypeInfo()
Definition Property.hpp:146
const std::any & getValue() const
Definition Property.hpp:111
tson::Project * m_project
Definition Property.hpp:48
const std::string & getName() const
Definition Property.hpp:121
Type m_type
Definition Property.hpp:49
void setValueByType(IJson &json)
Definition tileson_forward.hpp:603
const std::type_info & getValueType() const
Definition Property.hpp:133
std::string m_propertyType
Definition Property.hpp:51
void setStrValue(const std::string &value)
Definition Property.hpp:106
Type getType() const
Definition Property.hpp:151
void setName(const std::string &name)
Definition Property.hpp:116
std::string m_name
Definition Property.hpp:50
Type
Definition Enums.hpp:16