98bb43dfc19a5658336411f410915d0e1647381b
[platform/framework/native/appfw.git] / inc / FLclNumberSymbols.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                FLclNumberSymbols.h
19  * @brief               This is the header file for the %NumberSymbols class.
20  *
21  * This header file contains the declarations of the %NumberSymbols class.
22  *
23  */
24 #ifndef _FLCL_NUMBER_SYMBOLS_H_
25 #define _FLCL_NUMBER_SYMBOLS_H_
26
27 #include <FLclLocale.h>
28
29
30 namespace Tizen { namespace Locales
31 {
32
33 // Enums and Constants
34 /**
35  * @enum        NumberSymbol
36  *
37  * Defines the possible formats for number symbols. @n
38  *
39  * This enum represents the possible symbols for NumberFormatter.
40  *
41  * @since               2.0
42  */
43 enum NumberSymbol
44 {
45         NUMBER_SYMBOL_DECIMAL_SEPARATOR,                        /**< The decimal separator */
46         NUMBER_SYMBOL_GROUPING_SEPARATOR,                       /**< The grouping separator */
47         NUMBER_SYMBOL_PATTERN_SEPARATOR,                        /**< The pattern separator */
48         NUMBER_SYMBOL_PERCENT,                                          /**< The percent symbol */
49         NUMBER_SYMBOL_ZERO_DIGIT,                                       /**< The zero symbol*/
50         NUMBER_SYMBOL_DIGIT,                                            /**< The character representing a digit in the pattern */
51         NUMBER_SYMBOL_CURRENCY,                                         /**< The currency symbol */
52         NUMBER_SYMBOL_INTL_CURRENCY,                            /**< The international currency symbol */
53         NUMBER_SYMBOL_MONETARY_SEPARATOR,                       /**< The monetary separator */
54         NUMBER_SYMBOL_PER_MILL,                                         /**< The per mil symbol */
55         NUMBER_SYMBOL_EXPONENTIAL,                                      /**< The exponential symbol */
56         NUMBER_SYMBOL_PLUS_SIGN,                                        /**< The plus sign */
57         NUMBER_SYMBOL_MINUS_SIGN,                                       /**< The minus sign */
58         NUMBER_SYMBOL_COUNT                                                     /**< The number of symbol */
59 };
60
61
62 /**
63  * @class               NumberSymbols
64  * @brief               This class provides methods that help in providing number symbols.
65  *
66  * @since               2.0
67  *
68  * The %NumberSymbols class represents the set of symbols (such as the decimal separator and the grouping separator) needed by NumberFormatter to format numbers.
69  * %NumberFormatter creates its own instance of %NumberSymbols from its locale data. %NumberSymbols can be adopted by a %NumberFormatter instance, or it can be specified when a %NumberFormatter is created. If you need to change any of these symbols, you can get the %NumberSymbols instance from your %NumberFormatter and then modify it.
70  *
71  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/locales/num_symbols_currencies.htm">Number Symbols and Currencies</a>.
72  */
73 class _OSP_EXPORT_ NumberSymbols
74         : public Tizen::Base::Object
75 {
76 public:
77         /**
78          * This is the default constructor for this class. @n
79          * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
80          *
81          * @since               2.0
82          *
83          * @see Construct()
84          */
85         NumberSymbols(void);
86
87         /**
88          * This is the destructor for this class. @n
89          * This destructor overrides Tizen::Base::Object::~Object().
90          *
91          * @since               2.0
92          */
93         virtual ~NumberSymbols(void);
94
95
96         /**
97          * Initializes this instance of %NumberSymbols with the specified @c locale.
98          *
99          * @if OSPCOMPAT
100          * @brief                               <i> [Compatibility] </i> 
101          * @endif
102          * @since                               2.0
103          * @if OSPCOMPAT
104          * @compatibility     This method has compatibility issues with OSP compatible applications. @n
105         *                              For more information, see @ref CompNumberSymbolsConstructPage "here".
106          * @endif
107          *
108          * @return                              An error code
109          * @param[in]                   locale                                          An instance of Locale
110          * @exception                   E_SUCCESS                                       The method is successful.
111          * @exception                   E_OUT_OF_MEMORY                         The memory is insufficient.
112          * @exception                   E_INVALID_ARG           The specified @c locale is invalid. 
113          */
114         result Construct(const Locale& locale);
115
116         /**
117          * @if OSPCOMPAT
118          * @page                    CompNumberSymbolsConstructPage Compatibility for Construct()
119          * @section                   CompNumberSymbolsConstructIssueSection Issues
120          * Implementation of this method in OSP compatible applications has the following issue: @n
121          * -# The method returns E_UNSUPPORTED_OPERATION if the @c locale is invalid.
122          *
123          * @section                 CompNumberSymbolsConstructSolutionSection Resolutions
124          * This issue has been resolved in Tizen.
125          * @par When working in Tizen:
126          * -# The method returns E_INVALID_ARG if the @c locale is invalid.
127          * @endif
128          */
129
130         /**
131          * Gets the character used for number format.
132          *
133          * @since                               2.0
134          *
135          * @return                              The character used for number format, @n
136          *                                              else an empty string if the @c symbol is invalid
137          * @param[in]                   symbol                                          The number format symbol instance
138          * @see                                         SetNumberSymbol()
139          */
140         Tizen::Base::String GetNumberSymbol(NumberSymbol symbol) const;
141
142
143         /**
144          * Sets the character used for number format.
145          *
146          * @since                               2.0
147          *
148          * @return                              An error code
149          * @param[in]                   symbol                                          A symbol to set
150          * @param[in]                   str                                                     The new string for symbol
151          * @exception                   E_SUCCESS                                       The method is successful.
152          * @see                                         GetNumberSymbol()
153          */
154         result SetNumberSymbol(NumberSymbol symbol, const Tizen::Base::String& str);
155
156
157         /**
158          * Gets the current locale.
159          *
160          * @since                               2.0
161          *
162          * @return              A pointer to the current instance of Locale, @n
163          *                                              else @c null if this method fails
164          * @remarks                             The specific error code can be accessed using the GetLastResult() method.
165          */
166         const Locale* GetLocale(void) const;
167
168
169 private:
170         /**
171          * The implementation of this copy constructor is intentionally blank and declared as private to
172          * prohibit copying of objects.
173          */
174         NumberSymbols(const NumberSymbols& numberSymbols);
175
176         /**
177          * The implementation of this copy assignment operator is intentionally blank and declared as private
178          * to prohibit copying of objects.
179          */
180         NumberSymbols& operator =(const NumberSymbols& numberSymbols);
181
182
183         friend class _NumberSymbolsImpl;
184         class _NumberSymbolsImpl* __pNumberSymbolsImpl;
185
186 }; // NumberSymbols
187
188 }} // Tizen::Locales
189
190 #endif //_FLCL_NUMBER_SYMBOLS_H_
191