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