5#ifndef TILESON_PROPERTYCOLLECTION_HPP
6#define TILESON_PROPERTYCOLLECTION_HPP
25 inline void remove(
const std::string &name);
27 inline void setValue(
const std::string &name,
const std::any &value);
29 inline void setId(
const std::string &
id);
34 inline std::vector<Property*>
get();
36 inline T
getValue(
const std::string &name);
37 [[nodiscard]]
inline const std::string &
getId()
const;
38 [[nodiscard]]
inline size_t getSize()
const;
60 m_properties[
property.getName()] = property;
61 return &m_properties[
property.getName()];
67 const std::string name =
property.getName();
68 m_properties[name] = std::move(property);
69 return &m_properties[name];
74 m_properties[name] = {name, value, type};
75 return &m_properties[name];
80 m_properties.erase(name);
91 if(m_properties.count(name) > 0)
102 m_properties[name] = value;
112 return m_properties.count(name) > 0;
117 return (m_properties.count(name) > 0) ? &m_properties[name] :
nullptr;
131 std::vector<tson::Property *> props;
132 for(
auto &i : m_properties)
133 props.emplace_back(&i.second);
146 return m_properties.size();
Definition Project.hpp:20
Definition PropertyCollection.hpp:15
tson::Property * add(const tson::Property &property)
Definition PropertyCollection.hpp:58
void remove(const std::string &name)
Definition PropertyCollection.hpp:78
std::map< std::string, Property > & getProperties()
Definition PropertyCollection.hpp:120
T getValue(const std::string &name)
Definition PropertyCollection.hpp:47
std::string m_id
Definition PropertyCollection.hpp:41
void setProperty(const std::string &name, const tson::Property &value)
Definition PropertyCollection.hpp:100
std::vector< Property * > get()
Definition PropertyCollection.hpp:129
void setValue(const std::string &name, const std::any &value)
Definition PropertyCollection.hpp:89
bool hasProperty(const std::string &name)
Definition PropertyCollection.hpp:110
PropertyCollection()=default
std::map< std::string, tson::Property > m_properties
Definition PropertyCollection.hpp:42
tson::Property * getProperty(const std::string &name)
Definition PropertyCollection.hpp:115
const std::string & getId() const
Definition PropertyCollection.hpp:139
void setId(const std::string &id)
Definition PropertyCollection.hpp:105
size_t getSize() const
Definition PropertyCollection.hpp:144
Definition Property.hpp:23
void setValue(const std::any &value)
Definition Property.hpp:95
Type
Definition Enums.hpp:16