Merge "Update deprecated libprivilege-control API functions." into tizen
[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 for 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 
69  * NumberFormatter to format numbers. %NumberFormatter creates its own instance of %NumberSymbols from its locale data. 
70  * %NumberSymbols can be adapted by a %NumberFormatter instance, or it can be specified when a %NumberFormatter is created. 
71  * If you need to change any of these symbols, you can get the %NumberSymbols instance from your %NumberFormatter and then modify it.
72  *
73  * 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>.
74  */
75 class _OSP_EXPORT_ NumberSymbols
76         : public Tizen::Base::Object
77 {
78 public:
79         /**
80          * This is the default constructor for this class. @n
81          * The object is not fully constructed after this constructor is called. For full construction, the Construct() 
82          * method must be called right after calling this constructor.
83          *
84          * @since       2.0
85          */
86         NumberSymbols(void);
87
88         /**
89          * This is the destructor for this class. @n
90          * This destructor overrides Tizen::Base::Object::~Object().
91          *
92          * @since               2.0
93          */
94         virtual ~NumberSymbols(void);
95
96
97         /**
98          * Initializes this instance of %NumberSymbols with the specified @c locale.
99          *
100          * @if OSPCOMPAT
101          * @brief               <i> [Compatibility] </i>
102          * @endif
103          * @since               2.0
104          * @if OSPCOMPAT
105          * @compatibility       This method has compatibility issues with OSP compatible applications. @n
106          *                                      For more information, see @ref CompNumberSymbolsConstructPage "here".
107          * @endif
108          *
109          * @return                              An error code
110          * @param[in]                   locale                          An instance of Locale
111          * @exception                   E_SUCCESS                       The method is successful.
112          * @exception                   E_OUT_OF_MEMORY         The memory is insufficient.
113          * @exception                   E_INVALID_ARG           The specified @c locale is invalid. 
114          */
115         result Construct(const Locale& locale);
116
117         /**
118          * @if OSPCOMPAT
119      * @page                    CompNumberSymbolsConstructPage Compatibility for Construct()
120      * @section                   CompNumberSymbolsConstructIssueSection Issues
121      * Implementation of this method in OSP compatible applications has the following issue: @n
122      * -# The method returns @c E_UNSUPPORTED_OPERATION if the @c locale is invalid.
123      *
124      * @section                 CompNumberSymbolsConstructSolutionSection Resolutions
125      * This issue has been resolved in Tizen.
126          * @par When working in Tizen:
127      * -# The method returns @c E_INVALID_ARG if the @c locale is invalid.
128          * @endif
129      */
130
131         /**
132          * Gets the character used for number format.
133          *
134          * @since                               2.0
135          *
136          * @return                              The character used for number format, @n
137          *                                              else an empty string if the @c symbol is invalid
138          * @param[in]                   symbol                                          The number format symbol instance
139          * @see                                 SetNumberSymbol()
140          */
141         Tizen::Base::String GetNumberSymbol(NumberSymbol symbol) const;
142
143
144         /**
145          * Sets the character used for number format.
146          *
147          * @since                               2.0
148          *
149          * @return                              An error code
150          * @param[in]                   symbol                                          A symbol to set
151          * @param[in]                   str                                                     The new string for symbol
152          * @exception                   E_SUCCESS                                       The method is successful.
153          * @see                                 GetNumberSymbol()
154          */
155         result SetNumberSymbol(NumberSymbol symbol, const Tizen::Base::String& str);
156
157
158         /**
159          * Gets the current locale.
160          *
161          * @since                               2.0
162          *
163          * @return              A pointer to the current instance of Locale, @n
164          *                                              else @c null if it fails
165          * @remarks                             The specific error code can be accessed using the GetLastResult() method.
166          */
167         const Locale* GetLocale(void) const;
168
169
170 private:
171         /**
172          * The implementation of this copy constructor is intentionally blank and declared as private to
173          * prohibit copying of objects.
174          */
175         NumberSymbols(const NumberSymbols& numberSymbols);
176
177         /**
178          * The implementation of this copy assignment operator is intentionally blank and declared as private
179          * to prohibit copying of objects.
180          */
181         NumberSymbols& operator =(const NumberSymbols& numberSymbols);
182
183
184         friend class _NumberSymbolsImpl;
185         class _NumberSymbolsImpl* __pNumberSymbolsImpl;
186
187 }; // NumberSymbols
188
189 }} // Tizen::Locales
190
191 #endif //_FLCL_NUMBER_SYMBOLS_H_
192