Fix the boiler plate codes
[platform/framework/native/appfw.git] / inc / FBaseNumber.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                FBaseNumber.h
19  * @brief               This is the header file for the %Number class.
20  *
21  * This header file contains the declarations and definitions of the %Number class. @n
22  * This class is the abstract base class of all wrapped numeric types.
23  */
24 #ifndef _FBASE_NUMBER_H_
25 #define _FBASE_NUMBER_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29
30
31 namespace Tizen { namespace Base
32 {
33 /**
34  *      @class  Number
35  *      @brief  This class is the base class of all wrapped numeric types.
36  *
37  *      @since 2.0
38  *
39  *      The %Number class is the abstract base class of all wrapped numeric classes.
40  *      The subclasses of %Number must provide methods to convert the represented
41  *      numeric value to @c char, @c short, @c int, @c long, @c float, and @c double.
42  *
43  * The following example demonstrates how to use the %Number class.
44  *
45  *      @code
46  *
47  *      #include <FBase.h>
48  *
49  *      using namespace Tizen::Base;
50  *
51  *      void
52  *      MyClass::NumberSample(void)
53  *      {
54  *              Long ld(0x12345678L);
55  *              int i = ld.Toint();             // i == 0x5678
56  *              char ch = ld.ToChar();  // ch == 0x78 or 120
57  *              // ...
58  *              Int8 j(ch);
59  *              Float f1(j.ToFloat()); // f1 == 120.0
60  *              // ...
61  *              Double d(120.100005L);
62  *              Float f2(d.ToFloat());  // f2 == 120.10001
63  *              Integer k(f2.ToInt());  // k == 120
64  *      }
65  *      @endcode
66  */
67 class _OSP_EXPORT_ Number
68         : public Object
69 {
70 public:
71         /**
72          * This destructor overrides Tizen::Base::Object::~Object().
73          *
74          * @since 2.0
75          */
76         virtual ~Number(void) { };
77
78         /**
79          *      Gets the @c signed @c char equivalent of the current instance of the %Number class.
80          *
81          *      @since 2.0
82          *
83          *      @return         The @c signed @c char equivalent of the current instance
84          */
85         virtual char ToChar(void) const = 0;
86
87         /**
88          *      Gets the @c signed @c short equivalent of the current instance of the %Number class.
89          *
90          *      @since 2.0
91          *
92          *      @return         The @c signed @c short equivalent of the current instance
93          */
94         virtual short ToShort(void) const = 0;
95
96         /**
97          *      Gets the @c signed @c int equivalent of the current instance of the %Number class.
98          *
99          *      @since 2.0
100          *
101          *      @return         The @c signed @c int equivalent of the current instance
102          */
103         virtual int ToInt(void) const = 0;
104
105         /**
106          *      Gets the @c signed @c long equivalent of the current instance of the %Number class.
107          *
108          *      @since 2.0
109          *
110          *      @return         The @c signed @c long equivalent of the current instance
111          */
112         virtual long ToLong(void) const = 0;
113
114         /**
115         *       Gets the @c signed @c long @c long equivalent of the current instance of the %Number class.
116         *
117         *       @since 2.0
118         *
119         *       @return         The @c signed @c long @c long equivalent of the current instance
120         */
121         virtual long long ToLongLong(void) const = 0;
122
123         /**
124          *      Gets the @c signed @c float equivalent of the current instance of the %Number class.
125          *
126          *      @since 2.0
127          *
128          *      @return         The @c signed @c float equivalent of the current instance
129          */
130         virtual float ToFloat(void) const = 0;
131
132         /**
133          *      Gets the @c signed @c double equivalent of the current instance of the %Number class.
134          *
135          *      @since 2.0
136          *
137          *      @return         The @c signed @c double equivalent of the current instance
138          */
139         virtual double ToDouble(void) const = 0;
140
141         /**
142          *      Gets the string representing the value of the current instance of the %Number class.
143          *
144          *      @since 2.0
145          *
146          *      @return         The string representing the value of the current instance
147          */
148         virtual String ToString(void) const = 0;
149
150 protected:
151         //
152         // This method is for internal use only. Using this method can cause behavioral, security-related,
153         // and consistency-related issues in the application.
154         // This method is reserved and may change its name at any time without prior notice.
155         //
156         // @since 2.0
157         //
158         virtual void Number_Reserved1(void) { }
159
160         //
161         // This method is for internal use only. Using this method can cause behavioral, security-related,
162         // and consistency-related issues in the application.
163         // This method is reserved and may change its name at any time without prior notice.
164         //
165         // @since 2.0
166         //
167         virtual void Number_Reserved2(void) { }
168
169 }; // Number
170
171 }}   // Tizen::Base
172
173 #endif // _FBASE_NUMBER_H_