5#ifndef TILESON_TILEDCLASS_HPP
6#define TILESON_TILEDCLASS_HPP
16 [[nodiscard]]
inline uint32_t
getId()
const;
17 [[nodiscard]]
inline const std::string &
getName()
const;
18 [[nodiscard]]
inline const std::string &
getType()
const;
24 inline T
get(
const std::string &name);
29 std::string m_name {};
30 std::string m_type {};
31 PropertyCollection m_members {};
37 if(json.
count(
"id") > 0)
38 m_id = json[
"id"].
get<uint32_t>();
40 if(json.
count(
"name") > 0)
41 m_name = json[
"name"].get<std::string>();
42 if(json.
count(
"type") > 0)
43 m_type = json[
"type"].get<std::string>();
45 if(json.
count(
"members") > 0 && json[
"members"].
isArray())
47 auto &array = json.
array(
"members");
48 std::for_each(array.begin(), array.end(), [&](std::unique_ptr<IJson> &item)
50 m_members.add(*item, project);
96 if(json.
any(property->getName()))
105 std::vector<Property *> toUpdate;
111 if(member->getType() ==
property->getType())
113 toUpdate.push_back(property);
118 std::for_each(toUpdate.begin(), toUpdate.end(), [&](
Property *p)
120 m_members.setProperty(p->getName(), *p);
virtual bool any(std::string_view key) const =0
T get(std::string_view key)
Definition IJson.hpp:82
virtual bool isArray() const =0
virtual size_t count(std::string_view key) const =0
virtual std::vector< std::unique_ptr< IJson > > array()=0
Definition Project.hpp:20
Definition PropertyCollection.hpp:15
T getValue(const std::string &name)
Definition PropertyCollection.hpp:47
std::vector< Property * > get()
Definition PropertyCollection.hpp:129
bool hasProperty(const std::string &name)
Definition PropertyCollection.hpp:110
tson::Property * getProperty(const std::string &name)
Definition PropertyCollection.hpp:115
Definition Property.hpp:23
void setValueByType(IJson &json)
Definition tileson_forward.hpp:603
Definition TiledClass.hpp:11
PropertyCollection & getMembers()
Definition TiledClass.hpp:70
const std::string & getName() const
Definition TiledClass.hpp:60
tson::Property * getMember(const std::string &name)
Definition TiledClass.hpp:81
T get(const std::string &name)
Definition TiledClass.hpp:76
void update(IJson &json)
Definition TiledClass.hpp:92
const std::string & getType() const
Definition TiledClass.hpp:65
uint32_t getId() const
Definition TiledClass.hpp:55