Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / include / rive / generated / shapes / polygon_base.hpp
1 #ifndef _RIVE_POLYGON_BASE_HPP_
2 #define _RIVE_POLYGON_BASE_HPP_
3 #include "rive/core/field_types/core_double_type.hpp"
4 #include "rive/core/field_types/core_uint_type.hpp"
5 #include "rive/shapes/parametric_path.hpp"
6 namespace rive {
7     class PolygonBase : public ParametricPath {
8     protected:
9         typedef ParametricPath Super;
10
11     public:
12         static const uint16_t typeKey = 51;
13
14         /// Helper to quickly determine if a core object extends another without RTTI
15         /// at runtime.
16         bool isTypeOf(uint16_t typeKey) const override {
17             switch (typeKey) {
18                 case PolygonBase::typeKey:
19                 case ParametricPathBase::typeKey:
20                 case PathBase::typeKey:
21                 case NodeBase::typeKey:
22                 case TransformComponentBase::typeKey:
23                 case WorldTransformComponentBase::typeKey:
24                 case ContainerComponentBase::typeKey:
25                 case ComponentBase::typeKey:
26                     return true;
27                 default:
28                     return false;
29             }
30         }
31
32         uint16_t coreType() const override { return typeKey; }
33
34         static const uint16_t pointsPropertyKey = 125;
35         static const uint16_t cornerRadiusPropertyKey = 126;
36
37     private:
38         uint32_t m_Points = 5;
39         float m_CornerRadius = 0.0f;
40
41     public:
42         inline uint32_t points() const { return m_Points; }
43         void points(uint32_t value) {
44             if (m_Points == value) {
45                 return;
46             }
47             m_Points = value;
48             pointsChanged();
49         }
50
51         inline float cornerRadius() const { return m_CornerRadius; }
52         void cornerRadius(float value) {
53             if (m_CornerRadius == value) {
54                 return;
55             }
56             m_CornerRadius = value;
57             cornerRadiusChanged();
58         }
59
60         Core* clone() const override;
61         void copy(const PolygonBase& object) {
62             m_Points = object.m_Points;
63             m_CornerRadius = object.m_CornerRadius;
64             ParametricPath::copy(object);
65         }
66
67         bool deserialize(uint16_t propertyKey, BinaryReader& reader) override {
68             switch (propertyKey) {
69                 case pointsPropertyKey:
70                     m_Points = CoreUintType::deserialize(reader);
71                     return true;
72                 case cornerRadiusPropertyKey:
73                     m_CornerRadius = CoreDoubleType::deserialize(reader);
74                     return true;
75             }
76             return ParametricPath::deserialize(propertyKey, reader);
77         }
78
79     protected:
80         virtual void pointsChanged() {}
81         virtual void cornerRadiusChanged() {}
82     };
83 } // namespace rive
84
85 #endif