39 std::map<std::string, std::any> _attributes;
51 Properties(
const std::map<std::string, std::any> &attributes)
52 : _attributes(attributes) {}
62 template <
typename T> T
get(
const std::string &key)
const {
63 auto it = _attributes.find(key);
64 if (it != _attributes.end()) {
65 return std::any_cast<T>(it->second);
75 bool has(
const std::string &key)
const {
76 return _attributes.find(key) != _attributes.end();
Manages immutable component properties.
Properties(void)
Default constructor for empty properties.
bool has(const std::string &key) const
Check if a property key exists.
Properties(const std::map< std::string, std::any > &attributes)
Construct properties from a map of attributes.
T get(const std::string &key) const
Get a property value by key with type casting.
const std::map< std::string, std::any > & getAttributes(void) const
Get all property attributes.