up-to-date submodule(rive-cpp)
[platform/core/uifw/rive-tizen.git] / submodule / include / generated / animation / cubic_interpolator_base.hpp
1 #ifndef _RIVE_CUBIC_INTERPOLATOR_BASE_HPP_
2 #define _RIVE_CUBIC_INTERPOLATOR_BASE_HPP_
3 #include "core.hpp"
4 #include "core/field_types/core_double_type.hpp"
5 namespace rive
6 {
7         class CubicInterpolatorBase : public Core
8         {
9         protected:
10                 typedef Core Super;
11
12         public:
13                 static const uint16_t typeKey = 28;
14
15                 /// Helper to quickly determine if a core object extends another without
16                 /// RTTI at runtime.
17                 bool isTypeOf(uint16_t typeKey) const override
18                 {
19                         switch (typeKey)
20                         {
21                                 case CubicInterpolatorBase::typeKey:
22                                         return true;
23                                 default:
24                                         return false;
25                         }
26                 }
27
28                 uint16_t coreType() const override { return typeKey; }
29
30                 static const uint16_t x1PropertyKey = 63;
31                 static const uint16_t y1PropertyKey = 64;
32                 static const uint16_t x2PropertyKey = 65;
33                 static const uint16_t y2PropertyKey = 66;
34
35         private:
36                 float m_X1 = 0.42f;
37                 float m_Y1 = 0.0f;
38                 float m_X2 = 0.58f;
39                 float m_Y2 = 1.0f;
40         public:
41                 inline float x1() const { return m_X1; }
42                 void x1(float value)
43                 {
44                         if (m_X1 == value)
45                         {
46                                 return;
47                         }
48                         m_X1 = value;
49                         x1Changed();
50                 }
51
52                 inline float y1() const { return m_Y1; }
53                 void y1(float value)
54                 {
55                         if (m_Y1 == value)
56                         {
57                                 return;
58                         }
59                         m_Y1 = value;
60                         y1Changed();
61                 }
62
63                 inline float x2() const { return m_X2; }
64                 void x2(float value)
65                 {
66                         if (m_X2 == value)
67                         {
68                                 return;
69                         }
70                         m_X2 = value;
71                         x2Changed();
72                 }
73
74                 inline float y2() const { return m_Y2; }
75                 void y2(float value)
76                 {
77                         if (m_Y2 == value)
78                         {
79                                 return;
80                         }
81                         m_Y2 = value;
82                         y2Changed();
83                 }
84
85                 Core* clone() const override;
86                 void copy(const CubicInterpolatorBase& object)
87                 {
88                         m_X1 = object.m_X1;
89                         m_Y1 = object.m_Y1;
90                         m_X2 = object.m_X2;
91                         m_Y2 = object.m_Y2;
92                 }
93
94                 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
95                 {
96                         switch (propertyKey)
97                         {
98                                 case x1PropertyKey:
99                                         m_X1 = CoreDoubleType::deserialize(reader);
100                                         return true;
101                                 case y1PropertyKey:
102                                         m_Y1 = CoreDoubleType::deserialize(reader);
103                                         return true;
104                                 case x2PropertyKey:
105                                         m_X2 = CoreDoubleType::deserialize(reader);
106                                         return true;
107                                 case y2PropertyKey:
108                                         m_Y2 = CoreDoubleType::deserialize(reader);
109                                         return true;
110                         }
111                         return false;
112                 }
113
114         protected:
115                 virtual void x1Changed() {}
116                 virtual void y1Changed() {}
117                 virtual void x2Changed() {}
118                 virtual void y2Changed() {}
119         };
120 } // namespace rive
121
122 #endif