Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUi_VariantImpl.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  * @file                FUi_VariantImpl.h
19  * @brief               This is the header file for the _VariantImpl class.
20  *
21  * This header file contains declarations of the _VariantImpl class. @n
22  */
23 #ifndef _FUI_VARIANT_IMPL_H_
24 #define _FUI_VARIANT_IMPL_H_
25
26 #include <FUiVariant.h>
27
28 namespace Tizen { namespace Ui
29 {
30
31 typedef union
32 {
33         int valueInt;
34         unsigned int valueUInt;
35         bool valueBool;
36         float valueFloat;
37         double valueDouble;
38         long valueLong;
39         unsigned long valueULong;
40         long long valueLongLong;
41         unsigned long long valueULongLong;
42         Tizen::Base::String* pString;
43         Tizen::Base::DateTime* pDateTime;
44         Tizen::Graphics::Color* pColor;
45         Tizen::Graphics::Point* pPoint;
46         Tizen::Graphics::FloatPoint* pFloatPoint;
47         Tizen::Graphics::Rectangle* pRect;
48         Tizen::Graphics::FloatRectangle* pRectf;
49         Tizen::Graphics::Dimension* pDimension;
50         Tizen::Graphics::FloatDimension* pFloatDimension;
51         Tizen::Graphics::FloatMatrix4* pFloatMatrix4;
52 } VariantData;
53
54 class _VariantImpl
55         : public Tizen::Base::Object
56 {
57 public:
58         _VariantImpl(void);
59
60 private:
61         virtual ~_VariantImpl(void);
62
63         void AddRef(void);
64         void Release(void);
65
66         /*
67          * Deallocates an internal buffer.
68          *
69          * @since 2.0
70          */
71         void Clear(void);
72
73         /*
74          * Copy an internal buffer.
75          *
76          * @since 2.0
77          * @param[in]   value Variant value
78          */
79         void Copy(const Variant& rhs);
80
81         /*
82          * Deallocates an internal buffer.
83          *
84          * @since 2.0
85          * @param[in]   type VariantType
86          */
87         void SetVariantType(VariantType type);
88
89         /*
90          * Check if the type is same
91          *
92          * @since 2.0
93          * @param[in]   type VariantType
94          */
95         bool IsSameType(VariantType type) const;
96
97         /*
98          * This is the copy constructor for this class.
99          * @since 2.0
100          */
101         _VariantImpl(const _VariantImpl&);
102
103         /**
104          * This is the assignment operator for this class.
105          *
106          * @since 2.0
107          */
108         _VariantImpl& operator =(const _VariantImpl&);
109
110 public:
111         int __refCount;
112         VariantData __data;
113         VariantType __type;
114         friend class Variant;
115 }; // _VariantImpl
116
117 } }   // Tizen::Ui
118
119 #endif //_FUI_VARIANT_IMPL_H_