Revert " modify license, permission and remove ^M char"
[framework/osp/uifw.git] / src / ui / inc / FUi_Pointf.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FUiAnim_Pointf.h
20  * @brief               Header file of _Pointf class
21  *
22  * This file contains declarations _Pointf class.
23  */
24
25 #ifndef _FUI_ANIM_INTERNAL_POINTF_H_
26 #define _FUI_ANIM_INTERNAL_POINTF_H_
27
28 #include <FGrpPoint.h>
29
30 namespace Tizen { namespace Ui { namespace Animations
31 {
32
33 class _Pointf
34 {
35 public:
36         _Pointf(void)
37         {
38                 x = y = 0.0f;
39         }
40
41         _Pointf(float _x, float _y)
42                 : x(_x)
43                 , y(_y)
44         {
45         }
46
47         _Pointf(const _Pointf& point) { *this = point;}
48         _Pointf(const Tizen::Graphics::Point& point) { x = point.x; y = point.y;}
49
50         bool operator ==(const _Pointf& point) const
51         {
52                 return (x == point.x && y == point.y);
53         }
54
55         bool operator !=(const _Pointf& point) const
56         {
57                 return !(x == point.x && y == point.y);
58         }
59
60         _Pointf& operator =(const _Pointf& point)
61         {
62                 if (likely(&point != this))
63                 {
64                         x = point.x;
65                         y = point.y;
66                 }
67
68                 return *this;
69         }
70
71         _Pointf operator -(const _Pointf& point) const
72         {
73                 return _Pointf(x - point.x, y - point.y);
74         }
75
76         _Pointf operator +(const _Pointf& point) const
77         {
78                 return _Pointf(x + point.x, y + point.y);
79         }
80
81         void OffsetPoint(float xDelta, float yDelta)
82         {
83                 x += xDelta;
84                 y += yDelta;
85         }
86
87         void SetPoint(float xPoint, float yPoint)
88         {
89                 x = xPoint;
90                 y = yPoint;
91         }
92
93         float X(void) const { return x;}
94         float Y(void) const { return y;}
95         float& X(void) { return x;}
96         float& Y(void) { return y;}
97
98 public:
99         float x;
100         float y;
101 };              // _Pointf
102
103 }}}             // Tizen::Ui::Animations
104
105 #endif  // _FUI_ANIM_INTERNAL_POINTF_H_
106