1 #ifndef _RIVE_COMPONENT_BASE_HPP_
2 #define _RIVE_COMPONENT_BASE_HPP_
5 #include "core/field_types/core_string_type.hpp"
6 #include "core/field_types/core_uint_type.hpp"
9 class ComponentBase : public Core
15 static const uint16_t typeKey = 10;
17 /// Helper to quickly determine if a core object extends another without
19 bool isTypeOf(uint16_t typeKey) const override
23 case ComponentBase::typeKey:
30 uint16_t coreType() const override { return typeKey; }
32 static const uint16_t namePropertyKey = 4;
33 static const uint16_t parentIdPropertyKey = 5;
36 std::string m_Name = "";
39 inline const std::string& name() const { return m_Name; }
40 void name(std::string value)
50 inline int parentId() const { return m_ParentId; }
51 void parentId(int value)
53 if (m_ParentId == value)
61 void copy(const ComponentBase& object)
63 m_Name = object.m_Name;
64 m_ParentId = object.m_ParentId;
67 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
72 m_Name = CoreStringType::deserialize(reader);
74 case parentIdPropertyKey:
75 m_ParentId = CoreUintType::deserialize(reader);
82 virtual void nameChanged() {}
83 virtual void parentIdChanged() {}