Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / src / locales / FLcl_NumberFormatterImpl.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        FLcl_NumberFormatterImpl.h
19  * @brief       This is the header file for the _NumberFormatterImpl class.
20  */
21
22 #ifndef _FLCL_INTERNAL_NUMBER_FORMATTER_IMPL_H_
23 #define _FLCL_INTERNAL_NUMBER_FORMATTER_IMPL_H_
24
25 #include <FBaseString.h>
26 #include <FLclLocale.h>
27 #include <FLclCurrency.h>
28 #include "FLcl_FieldPosition.h"
29
30 namespace U_ICU_NAMESPACE
31 {
32 class DecimalFormat;
33 }
34
35 namespace Tizen { namespace Locales
36 {
37
38 // forward declaration
39 class NumberFormatter;
40 class _LocaleData;
41
42 enum NumberFormatterStyle
43 {
44         NUM_FORMATTER_STYLE_NUMBER,
45         NUM_FORMATTER_STYLE_CURRENCY,
46         NUM_FORMATTER_STYLE_PERCENT,
47         NUM_FORMATTER_STYLE_INVALID
48
49 };
50
51 enum NumberFormatterAttributes
52 {
53         NUM_FORMATTER_FIELD_CURRENCY,
54         NUM_FORMATTER_FIELD_POSITIVE_PREFIX,
55         NUM_FORMATTER_FIELD_NEGATIVE_PREFIX,
56         NUM_FORMATTER_FIELD_POSITIVE_SUFFIX,
57         NUM_FORMATTER_FIELD_NEGATIVE_SUFFIX,
58         NUM_FORMATTER_FIELD_PATTERN,
59         NUM_FORMATTER_FIELD_LOCALIZED_PATTERN,
60         NUM_FORMATTER_FIELD_STRING_VALUE_END,
61
62         NUM_FORMATTER_FIELD_MAX_INTEGER_DIGITS,
63         NUM_FORMATTER_FIELD_MIN_INTEGER_DIGITS,
64         NUM_FORMATTER_FIELD_MAX_FRACTION_DIGITS,
65         NUM_FORMATTER_FIELD_MIN_FRACTION_DIGITS,
66         NUM_FORMATTER_FIELD_MIN_EXPONENT_DIGITS,
67         NUM_FORMATTER_FIELD_MULTIPLIER,
68         NUM_FORMATTER_FIELD_GROUPING_SIZE,
69         NUM_FORMATTER_FIELD_INT_VALUE_END,
70
71         NUM_FORMATTER_FIELD_IS_GROUPING_USED,
72         NUM_FORMATTER_FIELD_IS_DECIMAL_SEPARATOR_ALWAYS_SHOWN,
73         NUM_FORMATTER_FIELD_IS_POSITIVE_SIGN_ALWAYS_SHOWN,
74         NUM_FORMATTER_FIELD_BOOL_VALUE_END,
75
76         NUM_FORMATTER_FIELD_INVALID
77 };
78
79 /**
80  * @class       _NumberFormatterImpl
81  * @brief       This class is for Number formatting.
82  * @since       1.1
83  *
84  */
85
86 class _NumberFormatterImpl
87         : public Tizen::Base::Object
88 {
89 public:
90
91         _NumberFormatterImpl(void);
92         virtual ~_NumberFormatterImpl(void);
93
94
95 public:
96         static NumberFormatter* CreateNumberFormatterN(NumberFormatterStyle style = NUM_FORMATTER_STYLE_NUMBER);
97         static NumberFormatter* CreateNumberFormatterN(const Locale& locale, NumberFormatterStyle style = NUM_FORMATTER_STYLE_NUMBER);
98
99         result ApplyPattern(const Tizen::Base::String& pattern, bool localized);
100
101         result Format(long number, Tizen::Base::String& str, _FieldPosition pos = 0) const;
102         result Format(double number, Tizen::Base::String& str, _FieldPosition pos = 0) const;
103
104         const Currency* GetCurrency(void);
105         void SetCurrency(const Currency& newValue);
106
107         virtual int GetMaxIntegerDigits(void) const;
108         virtual void SetMaxIntegerDigits(int newValue);
109
110         virtual int GetMinIntegerDigits(void) const;
111         virtual void SetMinIntegerDigits(int newValue);
112
113         virtual int GetMaxFractionDigits(void) const;
114         virtual void SetMaxFractionDigits(int newValue);
115
116         virtual int GetMinFractionDigits(void) const;
117         virtual void SetMinFractionDigits(int newValue);
118
119         virtual bool IsGroupingUsed(void) const;
120         virtual void SetGroupingUsed(bool newValue);
121
122         Tizen::Base::String GetPositivePrefix(void) const;
123         void SetPositivePrefix(const Tizen::Base::String& newValue);
124
125         Tizen::Base::String GetNegativePrefix(void) const;
126         void SetNegativePrefix(const Tizen::Base::String& newValue);
127
128         Tizen::Base::String GetPositiveSuffix(void) const;
129         void SetPositiveSuffix(const Tizen::Base::String& newValue);
130
131         Tizen::Base::String GetNegativeSuffix(void) const;
132         void SetNegativeSuffix(const Tizen::Base::String& newValue);
133
134         int GetMultiplier(void) const;
135         result SetMultiplier(int newValue);
136
137         int GetGroupingSize(void) const;
138         result SetGroupingSize(int newValue);
139
140         bool IsDecimalSeparatorAlwaysShown(void) const;
141         void SetDecimalSeparatorAlwaysShown(bool newValue);
142
143         bool IsPositiveSignAlwaysShown(void) const;
144         void SetPositiveSignAlwaysShown(bool newValue);
145
146 private:
147         _NumberFormatterImpl(const _NumberFormatterImpl& numberFormatterImpl);
148         _NumberFormatterImpl& operator =(const _NumberFormatterImpl& numberFormatterImpl);
149
150         Currency __currency;
151         U_ICU_NAMESPACE::DecimalFormat* __pIcuNumberFormatter;
152
153 }; // _NumberFormatterImpl
154
155 }} // Tizen::Locales
156
157 #endif //_FLCL_INTERNAL_NUMBER_FORMATTER_IMPL_H_
158