1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PROPERTIES_GEOMETRY_PROPERTY_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PROPERTIES_GEOMETRY_PROPERTY_H
18 
19 #include "base/geometry/ng/rect_t.h"
20 
21 namespace OHOS::Ace::NG {
22 class GeometryProperty {
23 public:
24     GeometryProperty() = default;
25     ~GeometryProperty() = default;
26 
27     bool operator==(const GeometryProperty& value)
28     {
29         return rect_ == value.rect_;
30     }
31 
Reset()32     void Reset()
33     {
34         rect_.Reset();
35     }
36 
GetRect()37     const RectF& GetRect() const
38     {
39         return rect_;
40     }
41 
SetSize(const SizeF & size)42     void SetSize(const SizeF& size)
43     {
44         rect_.SetSize(size);
45     }
46 
SetOffset(const OffsetF & offset)47     void SetOffset(const OffsetF& offset)
48     {
49         rect_.SetOffset(offset);
50     }
51 
ToString()52     std::string ToString() const
53     {
54         return rect_.ToString();
55     }
56 
57 private:
58     RectF rect_;
59     friend class GeometryNode;
60     friend class FrameProperty;
61     friend class LayoutBox;
62 };
63 } // namespace OHOS::Ace::NG
64 
65 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PROPERTIES_GEOMETRY_PROPERTY_H