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);
28 inline void setId(
const std::string &
id);
33 inline std::vector<Property*>
get();
35 inline T
getValue(
const std::string &name);
36 [[nodiscard]]
inline const std::string &
getId()
const;
37 [[nodiscard]]
inline size_t getSize()
const;
59 m_properties[
property.getName()] = property;
60 return &m_properties[
property.getName()];
66 std::string name =
property.getName();
67 m_properties[name] = std::move(property);
68 return &m_properties[name];
73 m_properties[name] = {name, value, type};
74 return &m_properties[name];
79 m_properties.erase(name);
90 if(m_properties.count(name) > 0)
91 m_properties[name].setValue(value);
101 return m_properties.count(name) > 0;
106 return (m_properties.count(name) > 0) ? &m_properties[name] :
nullptr;
120 std::vector<tson::Property *> props;
121 for(
auto &i : m_properties)
122 props.emplace_back(&i.second);
135 return m_properties.size();
Definition: PropertyCollection.hpp:15
tson::Property * add(const tson::Property &property)
Definition: PropertyCollection.hpp:57
void remove(const std::string &name)
Definition: PropertyCollection.hpp:77
std::map< std::string, Property > & getProperties()
Definition: PropertyCollection.hpp:109
T getValue(const std::string &name)
Definition: PropertyCollection.hpp:46
std::string m_id
Definition: PropertyCollection.hpp:40
std::vector< Property * > get()
Definition: PropertyCollection.hpp:118
void setValue(const std::string &name, const std::any &value)
Definition: PropertyCollection.hpp:88
bool hasProperty(const std::string &name)
Definition: PropertyCollection.hpp:99
PropertyCollection()=default
std::map< std::string, tson::Property > m_properties
Definition: PropertyCollection.hpp:41
tson::Property * getProperty(const std::string &name)
Definition: PropertyCollection.hpp:104
const std::string & getId() const
Definition: PropertyCollection.hpp:128
void setId(const std::string &id)
Definition: PropertyCollection.hpp:94
size_t getSize() const
Definition: PropertyCollection.hpp:133
Definition: Property.hpp:21
Definition: Base64.hpp:12
Type
Definition: Enums.hpp:16