Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Data.hpp
1#pragma once
2
3#include <Infinity/Types/Core/Base.hpp>
4#include <Infinity/Types/Core/PropertyValue.hpp>
5
6#include <cstdint>
7#include <cstring>
8#include <unordered_map>
9#include <string>
10
12{
48 class INFINITY_API_PUBLIC Data : public Base
49 {
50 public:
52 Data(const Data& other);
53 Data(Data&& other);
54 Data& operator=(const Data& other);
55 Data& operator=(Data&& other);
56
57 std::unique_ptr<Base> clone() const override;
58
59 virtual const Infinity::Types::TypeID& typeId() const override;
60
81 std::unordered_map<std::string, PropertyValue> properties;
82
88 virtual ~Data();
89
90 bool hasProperty(const std::string& key) const;
91
108 template<typename T>
109 void setProperty(const std::string& key, T&& value);
110
127 template<typename T>
128 void setProperty(const std::string& key, const T& value);
129
145 void setProperty(const std::string& key, PropertyValue&& value);
146
163 const PropertyValue& getProperty(const std::string& key) const;
164
194 template<typename T>
195 const T& getProperty(const std::string& key) const;
196
197 void removeProperty(const std::string& key);
198 };
199}
200
201#include <Infinity/Types/Core/Data.inl>
202
203// Register Data type in the type system
204INFINITY_TYPE(Infinity::Types::Core::Data)
Abstract base class for all Infinity Engine data types.
Definition Base.hpp:43
Base class for complex data types with memory wrapping and property support.
Definition Data.hpp:49
Data & operator=(Data &&other)
std::unordered_map< std::string, PropertyValue > properties
Property storage for arbitrary metadata.
Definition Data.hpp:81
virtual ~Data()
Virtual destructor.
std::unique_ptr< Base > clone() const override
Data & operator=(const Data &other)
virtual const Infinity::Types::TypeID & typeId() const override
Gets the runtime type identifier for this object.
const PropertyValue & getProperty(const std::string &key) const
Gets a property value without type checking.
Data(const Data &other)
void removeProperty(const std::string &key)
void setProperty(const std::string &key, PropertyValue &&value)
Sets a typed property value.
bool hasProperty(const std::string &key) const
Definition PropertyValue.hpp:14
Definition Base.hpp:12
Runtime type identifier for the Infinity type system.
Definition TypeID.hpp:71