up-to-date submodule(rive-cpp)
[platform/core/uifw/rive-tizen.git] / submodule / include / generated / component_base.hpp
1 #ifndef _RIVE_COMPONENT_BASE_HPP_
2 #define _RIVE_COMPONENT_BASE_HPP_
3 #include <string>
4 #include "core.hpp"
5 #include "core/field_types/core_string_type.hpp"
6 #include "core/field_types/core_uint_type.hpp"
7 namespace rive
8 {
9         class ComponentBase : public Core
10         {
11         protected:
12                 typedef Core Super;
13
14         public:
15                 static const uint16_t typeKey = 10;
16
17                 /// Helper to quickly determine if a core object extends another without
18                 /// RTTI at runtime.
19                 bool isTypeOf(uint16_t typeKey) const override
20                 {
21                         switch (typeKey)
22                         {
23                                 case ComponentBase::typeKey:
24                                         return true;
25                                 default:
26                                         return false;
27                         }
28                 }
29
30                 uint16_t coreType() const override { return typeKey; }
31
32                 static const uint16_t namePropertyKey = 4;
33                 static const uint16_t parentIdPropertyKey = 5;
34
35         private:
36                 std::string m_Name = "";
37                 int m_ParentId = 0;
38         public:
39                 inline const std::string& name() const { return m_Name; }
40                 void name(std::string value)
41                 {
42                         if (m_Name == value)
43                         {
44                                 return;
45                         }
46                         m_Name = value;
47                         nameChanged();
48                 }
49
50                 inline int parentId() const { return m_ParentId; }
51                 void parentId(int value)
52                 {
53                         if (m_ParentId == value)
54                         {
55                                 return;
56                         }
57                         m_ParentId = value;
58                         parentIdChanged();
59                 }
60
61                 void copy(const ComponentBase& object)
62                 {
63                         m_Name = object.m_Name;
64                         m_ParentId = object.m_ParentId;
65                 }
66
67                 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
68                 {
69                         switch (propertyKey)
70                         {
71                                 case namePropertyKey:
72                                         m_Name = CoreStringType::deserialize(reader);
73                                         return true;
74                                 case parentIdPropertyKey:
75                                         m_ParentId = CoreUintType::deserialize(reader);
76                                         return true;
77                         }
78                         return false;
79                 }
80
81         protected:
82                 virtual void nameChanged() {}
83                 virtual void parentIdChanged() {}
84         };
85 } // namespace rive
86
87 #endif