[devel_3.0_main] Cherry-pick Beautification of source-code. 80383
[platform/framework/native/appfw.git] / src / base / FBase_CharacterImpl.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                FBase_CharacterImpl.h
19  * @brief               This is the header file for the _CharacterImpl class.
20  *
21  * This header file contains the declarations of the _CharacterImpl class.
22  */
23 #ifndef _FBASE_INTERNAL_CHARACTER_IMPL_H_
24 #define _FBASE_INTERNAL_CHARACTER_IMPL_H_
25
26 #include <FBaseObject.h>
27 #include <FBaseString.h>
28 #include <FBaseCharacter.h>
29
30 namespace Tizen { namespace Base
31 {
32
33 class _CharacterImpl
34 {
35 public:
36         /**
37          * This is the destructor for this class.
38          *
39          * @since 2.0
40          */
41         virtual ~_CharacterImpl(void);
42
43         /**
44          *      Categorizes a Unicode character into a group identified by @n
45          *      one of the UnicodeCategory values.
46          *
47          *      @since 2.0
48          *
49          *      @return         A UnicodeCategory value that identifies the group that contains ch
50          *      @param[in]      ch  The Unicode character to categorize
51          *
52          */
53         static UnicodeCategory GetUnicodeCategory(wchar_t ch);
54
55         /**
56          *      Converts the input Unicode character to its equivalent lowercase.@n
57          *      Unicode characters other than English alphabets are also supported.
58          *
59          *      @since 2.0
60          *
61          *      @return         A lowercase equivalent of the input Unicode character
62          *      @param[in]      ch  A Unicode character to convert
63          */
64         static wchar_t ToLowerCase(wchar_t ch);
65
66         /**
67          *      Converts the input Unicode character to its equivalent uppercase.@n
68          *      Unicode characters other than English alphabets are also supported.
69          *
70          *      @since 2.0
71          *
72          *      @return         An uppercase equivalent of the input Unicode character
73          *      @param[in]      ch  A Unicode character to convert
74          */
75         static wchar_t ToUpperCase(wchar_t ch);
76
77         /**
78          *      Checks whether the input character is a digit or not.
79          *
80          *      @since 2.0
81          *      @return         @c true, if the input character is a digit @n
82          *                      @c false, otherwise
83          *      @param[in]      ch      A Unicode character
84          */
85         static bool IsDigit(wchar_t ch);
86
87         /**
88          *      Checks whether the input character is an alphabet or not.
89          *
90          *      @since 2.0
91          *      @return         @c true, if the input character is an alphabet @n
92          *                      @c false, otherwise
93          *      @param[in]      ch      A Unicode character
94          */
95         static bool IsLetter(wchar_t ch);
96
97         /**
98          *      Checks whether the input character is a lowercase alphabet or not.@n
99          *      Unicode characters other than English alphabets are also supported.
100          *
101          *      @since 2.0
102          *
103          *      @return         @c true, if the input character is a lowercase alphabet @n
104          *                      @c false, otherwise
105          *      @param[in]      ch      A Unicode character
106          */
107         static bool IsLowerCase(wchar_t ch);
108
109         /**
110          *      Checks whether the input character is an uppercase alphabet or not.@n
111          *      Unicode characters other than English alphabets are also supported.
112          *
113          *      @since 2.0
114          *
115          *      @return         @c true, if the input character is an uppercase alphabet @n
116          *                      @c false, otherwise
117          *      @param[in]      ch      A Unicode character
118          */
119         static bool IsUpperCase(wchar_t ch);
120
121         /**
122          *      Returns the value of the input character in the supplied radix. The value of radix must be between RADIX_MIN and RADIX_MAX.
123          *
124          *      @since 2.0
125          *
126          *      @return         ch   the character to determine the value
127
128          *      @param[in]      radix   the radix
129          */
130         static int ToDigit(wchar_t ch, int radix);
131
132         /**
133          *      Returns the character which represents the input digit with specified radix. The value of radix must be between RADIX_MIN and RADIX_MAX.
134          *
135          *      @since 2.0
136          *
137          *      @return         A wide character value in radix if radix lies between RADIX_MIN and RADIX_MAX; null character (U+0000) otherwise
138          *      @param[in]      digit   the digit to determine the value
139          *      @param[in]      radix   the radix
140          */
141         static wchar_t ForDigit(int digit, int radix);
142
143         /**
144          *      Returns the numeric value of the input unicode character. This is used when some numeric values are fractions, negative, or too large for int32_t.
145          *
146          *      @since 2.0
147          *
148          *      @return         A double value; -1 For characters without any numeric values in the Unicode Character
149          *      @param[in]      ch      A Unicode character
150          */
151         static double GetNumericValue(wchar_t ch);
152
153         /**
154          *      Checks whether the input character is defined, which usually means that it is assigned a character in the Unicode.
155          *
156          *      @since 2.0
157          *
158          *      @return         @c true, if the Unicode character is an assigned character @n
159          *                      @c false, otherwise
160          *      @param[in]      ch      A Unicode character
161          */
162         static bool IsDefined(wchar_t ch);
163
164         /**
165          *      Checks whether the input character is a whitespace character
166          *
167          *      @since 2.0
168          *
169          *      @return         @c true, if the Unicode character is a whitespace character @n
170          *                      @c false, otherwise
171          *      @param[in]      ch      A Unicode character
172          */
173         static bool IsWhitespace(wchar_t ch);
174
175         /**
176          *      Checks whether the input character is a title character
177          *
178          *      @since 2.0
179          *
180          *      @return         @c true, if the Unicode character is a title character @n
181          *                      @c false, otherwise
182          *      @param[in]      ch      A Unicode character
183          */
184         static bool IsTitleCase(wchar_t ch);
185
186         /**
187          *      Returns the title case equivalent for the input character if it exists.
188          *
189          *      @since 2.0
190          *
191          *      @return         A title case character equivalent for the input character. The character itself is returned if none is defined.
192          *      @param[in]      ch      A Unicode character
193          */
194         static wchar_t ToTitleCase(wchar_t ch);
195
196         /**
197          *      Checks whether the input character is an ISO control code or not.
198          *
199          *      @since 2.0
200          *
201          *      @return         @c true, if the Unicode character is an ISO control character @n
202          *                      @c false, otherwise
203          *      @param[in]      ch      A Unicode character
204          */
205         static bool IsISOControl(wchar_t ch);
206
207         /**
208          *      Checks whether the input character is a control code.
209          *
210          *      @return         @c true, if the input character is a control code @n
211                          @c false, otherwise
212          *      @param[in]      ch      A character code
213          */
214         static bool IsControl(wchar_t ch);
215
216         /**
217          *      Returns whether the input character is a punctuation mark or not.
218          *
219          *      @return         @c true, if the input character is a punctuation mark @n
220                          @c false, otherwise
221          *      @param[in]      ch      A character code
222          */
223         static bool IsPunctuation(wchar_t ch);
224
225         /**
226          *      Returns whether the input character is the value between
227          *      (0xD800) and (0xF8FF) or not.
228          *
229          *      @return         @c true, if the input character is between (0xD800) and (0xF8FF) @n
230                         @c false, otherwise
231          *      @param[in]      ch      A character code
232          */
233         static bool IsSurrogate(wchar_t ch);
234
235         /**
236          *      Checks whether the input character is the arrow code.
237          *
238          *      @return         @c true, if the input character is the arrow code @n
239                          @c false, otherwise
240          *      @param[in]      ch      A character code
241          */
242         static bool IsArrow(wchar_t ch);
243
244         /**
245          *      Checks whether the input character is a math code.
246          *
247          *      @return         @c true, if the input character is a math code @n
248                          @c false, otherwise
249          *      @param[in]      ch      A character code
250          */
251         static bool IsMath(wchar_t ch);
252
253         /**
254          *      Checks whether the input character is the modifier code.
255          *
256          *      @return         @c true, if the input character is the modifier code @n
257                          @c false, otherwise
258          *      @param[in]      ch      A character code
259          */
260         static bool IsModifier(wchar_t ch);
261
262         /**
263          *      Checks whether the input character is an Hangul code.
264          *
265          *      @return         @c true, if the input character is an Hangul code @n
266                          @c false, otherwise
267          *      @param[in]      ch      A character code
268          */
269         static bool IsHangul(wchar_t ch);
270
271         /**
272          *      Checks whether the input character is a Chinese code.
273          *
274          *      @return          @c true, if the input character is a Chinese code @n
275                          @c false, otherwise
276          *      @param[in]      ch      A character code
277          */
278         static bool IsCJK(wchar_t ch);
279
280         /**
281          *      Checks whether the input character is a Combining code.
282          *
283          *      @return         @c true, if the input character is a Combining code @n
284                          @c false, otherwise
285          *      @param[in]      ch      A character code
286          */
287         static bool IsCombining(wchar_t ch);
288
289         /**
290          *      Checks whether the input character is a language code.
291          *
292          *      @return         @c true, if the input character is a language code @n
293                          @c false, otherwise
294          *      @param[in]      ch      A character code
295          */
296         static bool IsLanguage(wchar_t ch);
297
298 private:
299         /**
300          * This is the default constructor for this class.
301          *
302          * @since 2.0
303          */
304         _CharacterImpl(wchar_t value);
305
306         /**
307          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
308          *
309          * @since 2.0
310          * @param[in]   rhs     An instance of %_CharacterImpl
311          */
312         _CharacterImpl& operator =(const _CharacterImpl& rhs);
313
314 }; // _CharacterImpl
315
316 }} // Tizen::Base
317
318 #endif // _FBASE_INTERNAL_CHARACTER_IMPL_H_