2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FLcl_NumberFormatterImpl.h
19 * @brief This is the header file for the _NumberFormatterImpl class.
22 #ifndef _FLCL_INTERNAL_NUMBER_FORMATTER_IMPL_H_
23 #define _FLCL_INTERNAL_NUMBER_FORMATTER_IMPL_H_
25 #include <FBaseString.h>
26 #include <FLclLocale.h>
27 #include <FLclCurrency.h>
28 #include "FLcl_FieldPosition.h"
30 namespace U_ICU_NAMESPACE
35 namespace Tizen { namespace Locales
38 // forward declaration
39 class NumberFormatter;
42 enum NumberFormatterStyle
44 NUM_FORMATTER_STYLE_NUMBER,
45 NUM_FORMATTER_STYLE_CURRENCY,
46 NUM_FORMATTER_STYLE_PERCENT,
47 NUM_FORMATTER_STYLE_INVALID
51 enum NumberFormatterAttributes
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,
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,
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,
76 NUM_FORMATTER_FIELD_INVALID
80 * @class _NumberFormatterImpl
81 * @brief This class is for Number formatting.
86 class _NumberFormatterImpl
87 : public Tizen::Base::Object
91 _NumberFormatterImpl(void);
92 virtual ~_NumberFormatterImpl(void);
96 static NumberFormatter* CreateNumberFormatterN(NumberFormatterStyle style = NUM_FORMATTER_STYLE_NUMBER);
97 static NumberFormatter* CreateNumberFormatterN(const Locale& locale, NumberFormatterStyle style = NUM_FORMATTER_STYLE_NUMBER);
99 result ApplyPattern(const Tizen::Base::String& pattern, bool localized);
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;
104 const Currency* GetCurrency(void);
105 void SetCurrency(const Currency& newValue);
107 virtual int GetMaxIntegerDigits(void) const;
108 virtual void SetMaxIntegerDigits(int newValue);
110 virtual int GetMinIntegerDigits(void) const;
111 virtual void SetMinIntegerDigits(int newValue);
113 virtual int GetMaxFractionDigits(void) const;
114 virtual void SetMaxFractionDigits(int newValue);
116 virtual int GetMinFractionDigits(void) const;
117 virtual void SetMinFractionDigits(int newValue);
119 virtual bool IsGroupingUsed(void) const;
120 virtual void SetGroupingUsed(bool newValue);
122 Tizen::Base::String GetPositivePrefix(void) const;
123 void SetPositivePrefix(const Tizen::Base::String& newValue);
125 Tizen::Base::String GetNegativePrefix(void) const;
126 void SetNegativePrefix(const Tizen::Base::String& newValue);
128 Tizen::Base::String GetPositiveSuffix(void) const;
129 void SetPositiveSuffix(const Tizen::Base::String& newValue);
131 Tizen::Base::String GetNegativeSuffix(void) const;
132 void SetNegativeSuffix(const Tizen::Base::String& newValue);
134 int GetMultiplier(void) const;
135 result SetMultiplier(int newValue);
137 int GetGroupingSize(void) const;
138 result SetGroupingSize(int newValue);
140 bool IsDecimalSeparatorAlwaysShown(void) const;
141 void SetDecimalSeparatorAlwaysShown(bool newValue);
143 bool IsPositiveSignAlwaysShown(void) const;
144 void SetPositiveSignAlwaysShown(bool newValue);
147 _NumberFormatterImpl(const _NumberFormatterImpl& numberFormatterImpl);
148 _NumberFormatterImpl& operator =(const _NumberFormatterImpl& numberFormatterImpl);
151 U_ICU_NAMESPACE::DecimalFormat* __pIcuNumberFormatter;
153 }; // _NumberFormatterImpl
157 #endif //_FLCL_INTERNAL_NUMBER_FORMATTER_IMPL_H_