Merge "Unchecked GetCharacter func when index is over string length" into tizen_2.2
[platform/framework/native/uifw.git] / inc / FGrpFloatVector4.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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        FGrpFloatVector4.h
20  * @brief       This is the header file for the %FloatVector4 class.
21  *
22  * This header file contains the declarations of the %FloatVector4 class.
23  *
24  */
25
26 #ifndef _FGRP_FLOAT_VECTOR4_H_
27 #define _FGRP_FLOAT_VECTOR4_H_
28
29 #include <FBaseObject.h>
30
31 namespace Tizen { namespace Graphics
32 {
33 class FloatPoint3;
34 class FloatMatrix4;
35 }}
36
37 namespace Tizen { namespace Graphics
38 {
39 /**
40  * @class       FloatVector4
41  * @brief       This class encapsulates a 4-dimensional vector.
42  *
43  * @since 2.0
44  *
45  * The %FloatVector4 class provides a float precision, four-dimensional vector class.
46  *
47  */
48 class _OSP_EXPORT_ FloatVector4
49         : public Tizen::Base::Object
50 {
51 public:
52         /**
53          * This is the default constructor for this class. @n
54          * This constructor initializes the instance to a 4-dimensional zero vector.
55          *
56          * @since 2.0
57          */
58         FloatVector4(void);
59
60         /**
61          * This is the copy constructor for the %FloatVector4 class. @n
62          * This constructor initializes the instance of %FloatVector4 with the attributes of the specified instance of %FloatVector4.
63          *
64          * @since 2.0
65          *
66          * @param[in]   rhs     An instance of %FloatVector4
67          */
68         FloatVector4(const FloatVector4& rhs);
69
70         /**
71          * This constructor initializes the instance of %FloatVector4 with the attributes of the specified instance of %FloatPoint3.
72          *
73          * @since 2.0
74          *
75          * @param[in]   point   An instance of %FloatPoint3
76          * @remarks     The point is converted to normal vector.
77          */
78         explicit FloatVector4(const FloatPoint3& point);
79
80         /**
81          * This constructor initializes the instance of %FloatVector4 with the attributes of the specified instance of the array.
82          *
83          * @since 2.0
84          *
85          * @param[in]   vector  The vector with 4 float values
86          */
87         explicit FloatVector4(const float vector[4]);
88
89         /**
90          * This constructor initializes the instance of %FloatVector4 with floating point numbers for each coordinate.
91          *
92          * @since 2.0
93          *
94          * @param[in]   x       x component of vector instance
95          * @param[in]   y       y component of vector instance
96          * @param[in]   z       z component of vector instance
97          * @param[in]   w       w component of vector instance
98          */
99         FloatVector4(float x, float y, float z, float w);
100
101         /**
102          * This destructor overrides Tizen::Base::Object::~Object().
103          *
104          * @since 2.0
105          */
106         virtual ~FloatVector4(void);
107
108         /**
109          * Checks whether the current instance and the specified instance of %FloatVector4 are equal.
110          *
111          * @since 2.0
112          *
113          * @return      @c true if all members of the current vector instance are equal to the corresponding vector members in the specified instance, @n
114          *                      else @c false
115          * @param[in]   rhs     An instance of %FloatVector4
116          */
117         bool operator ==(const FloatVector4& rhs) const;
118
119         /**
120          * Checks whether the current instance and the specified instance of %FloatVector4 are not equal.
121          *
122          * @since 2.0
123          *
124          * @return      @c true if all vector members of the current instance are not equal to the corresponding vector members in the specified instance, @n
125          *                      else @c false
126          * @param[in]   rhs     An instance of %FloatVector4
127          */
128         inline bool operator !=(const FloatVector4& rhs) const
129         {
130                 return !(*this == rhs);
131         }
132
133         /**
134          * Assigns the values of the specified instance to the current instance of %FloatVector4.
135          *
136          * @since 2.0
137          *
138          * @return      The reference to this instance
139          * @param[in]   rhs     An instance of %FloatVector4
140          */
141         FloatVector4& operator =(const FloatVector4& rhs);
142
143         /**
144          * Multiplies the value to each vector members of current instance of %FloatVector4.
145          *
146          * @since 2.0
147          *
148          * @return      A new instance of %FloatVector4 containing the resulting value of the operation
149          * @param[in]   value   A @c float value to multiply
150          */
151         FloatVector4 operator *(float value) const;
152
153         /**
154          * Divides each vector members of current instance of %FloatVector4 with the specified value.
155          *
156          * @since 2.0
157          *
158          * @return      A new instance of %FloatVector4 containing the resulting value of the operation
159          * @param[in]   value   A @c float value to divide
160          */
161         FloatVector4 operator /(float value) const;
162
163         /**
164          * Adds the value of the specified instance and the current instance of %FloatVector4.
165          *
166          * @since 2.0
167          *
168          * @return      A new instance of %FloatVector4 containing the resulting value of the operation
169          * @param[in]   rhs     An instance of %FloatVector4
170          */
171         FloatVector4 operator +(const FloatVector4& rhs) const;
172
173         /**
174          * Subtracts the value of the specified instance from the current instance of %FloatVector4.
175          *
176          * @since 2.0
177          *
178          * @return      A new instance of %FloatVector4 containing the resulting value of the operation
179          * @param[in]   rhs     An instance of %FloatVector4
180          */
181         FloatVector4 operator -(const FloatVector4& rhs) const;
182
183         /**
184          * Adds the value of the specified instance to the current instance of %FloatVector4.
185          *
186          * @since 2.0
187          *
188          * @return      The reference to %FloatVector4 containing the resulting value of the operation
189          * @param[in]   rhs     An instance of %FloatVector4
190          */
191         FloatVector4& operator +=(const FloatVector4& rhs);
192
193         /**
194          * Subtracts the value of the specified instance from the current instance of %FloatVector4.
195          *
196          * @since 2.0
197          *
198          * @return      The reference to %FloatVector4 containing the resulting value of the operation
199          * @param[in]   rhs     An instance of %FloatVector4
200          */
201         FloatVector4& operator -=(const FloatVector4& rhs);
202
203         /**
204          * Calculates the dot product with the specified instance and the current instance of %FloatVector4.
205          *
206          * @since 2.0
207          *
208          * @return      The value of the operation.
209          * @param[in]   rhs     An instance of %FloatVector4
210          */
211         float DotProduct(const FloatVector4& rhs) const;
212
213         /**
214          * Calculates the dot product with the specified instance and the current instance of %FloatVector4.
215          *
216          * @since 2.0
217          *
218          * @return      The value of the operation.
219          * @param[in]   rhs     An instance of %FloatVector4
220          */
221         float operator *(const FloatVector4& rhs) const;
222
223         /**
224          * Checks whether the current instance of %FloatVector4 equals the specified instance of %FloatVector4.
225          *
226          * @since 2.0
227          *
228          * @return      @c true if the values of the current instance is equal to the value of the specified instance, @n
229          *                      else @c false
230          * @param[in]   obj     An instance of %FloatVector4
231          * @remarks     This method overrides Tizen::Base::Object::Equals(). This method uses the values of the Vector components to compare the two instances.
232          */
233         virtual bool Equals(const Tizen::Base::Object& obj) const;
234
235         /**
236          * Gets the hash value of the current instance of %FloatVector4.
237          *
238          * @since 2.0
239          *
240          * @return      The hash value of the current instance
241          * @remarks     Two equal instances must return the same hash value. For better performance,
242          *                              the used hash function must generate a random distribution for all inputs.
243          */
244         virtual int GetHashCode(void) const;
245
246         /**
247          * Gets the length of the current instance of %FloatVector4.
248          *
249          * @since 2.0
250          *
251          * @return      The length of the current instance
252          */
253         float GetLength(void) const;
254
255         /**
256          * Gets the normal vector of the current instance of %FloatVector4.
257          *
258          * @since 2.0
259          *
260          * @return      A new instance of %FloatVector4 containing the resulting value of the operation
261          */
262         FloatVector4 GetNormal(void) const;
263
264         /**
265          * Normalize the current instance of %FloatVector4.
266          *
267          * @since 2.0
268          */
269         void Normalize(void);
270
271         /**
272          * x component of the current instance of %FloatVector4.
273          *
274          * @since 2.0
275          */
276         float x;
277
278         /**
279          * y component of the current instance of %FloatVector4.
280          *
281          * @since 2.0
282          */
283         float y;
284
285         /**
286          * z component of the current instance of %FloatVector4.
287          *
288          * @since 2.0
289          */
290         float z;
291
292         /**
293          * w component of the current instance of %FloatVector4.
294          *
295          * @since 2.0
296          */
297         float w;
298
299 private:
300         friend class _FloatVector4Impl;
301         class _FloatVector4Impl* __pImpl;
302
303 }; // FloatVector4
304
305 /**
306  * Gets the instance of %FloatVector4 resulting from the product of the value and the specified instance of %FloatVector4.
307  *
308  * @since 2.0
309  *
310  * @return      A new instance of %FloatVector4 containing the resulting value of the operation
311  * @param[in]   value   A @c float value to multiply
312  * @param[in]   rhs     An instance of %FloatVector4
313  */
314 _OSP_EXPORT_ FloatVector4 operator *(const float& value, const FloatVector4& rhs);
315
316 /**
317  * Gets the instance of %FloatVector4 resulting from the divide of the value and the specified instance of %FloatVector4.
318  *
319  * @since 2.0
320  *
321  * @return      A new instance of %FloatVector4 containing the resulting value of the operation
322  * @param[in]   value   A @c float value to divide
323  * @param[in]   rhs     An instance of %FloatVector4
324  */
325 _OSP_EXPORT_ FloatVector4 operator /(const float& value, const FloatVector4& rhs);
326
327 }} // Tizen::Graphics
328
329 #endif //_FGRP_FLOAT_VECTOR4_H_