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_DateTimeFormatterImpl.h
19 * @brief This is the header file for the _DateTimeFormatterImpl class.
21 * This header file contains the declarations of the _DateTimeFormatterImpl class.
24 #ifndef _FLCL_INTERNAL_DATE_TIME_FORMATTER_IMPL_H_
25 #define _FLCL_INTERNAL_DATE_TIME_FORMATTER_IMPL_H_
28 #include <FLclLocale.h>
29 #include <FLclCalendar.h>
30 #include <FLclDateTimeSymbols.h>
31 #include <FLclDateTimeFormatter.h>
34 namespace Tizen { namespace Locales
36 class NumberFormatter;
41 namespace U_ICU_NAMESPACE
43 class SimpleDateFormat;
46 namespace Tizen { namespace Locales
49 class _DateTimeFormatterImpl
50 : public Tizen::Base::Object
54 _DateTimeFormatterImpl(void);
55 ~_DateTimeFormatterImpl(void);
58 static DateTimeFormatter* CreateInstanceN(const Locale& locale, DateTimeStyle dateStyle, DateTimeStyle timeStyle);
59 static DateTimeFormatter* CreateInstanceN(DateTimeStyle dateStyle, DateTimeStyle timeStyle);
65 * Formats a DateTime object into a date/time string and appends the resulting string to the specified string buffer.
68 * @return An error code
69 * @param[in] date The DateTime object to format
70 * @param[out] str The String to append the resulting string to
71 * @exception E_SUCCESS The method was successful.
72 * @remarks This method does not handle the time zone information, so "z" pattern always returns "GMT+00:00".
73 * @see Tizen::Base::DateTime
75 virtual result Format(const Tizen::Base::DateTime& date, Tizen::Base::String& str) const;
79 * Formats a Calendar object into a date/time string and appends the resulting string to the specified string buffer.
82 * @return An error code
83 * @param[in] calendar The Calendar object to format
84 * @param[out] str The String to append the resulting string to
85 * @exception E_SUCCESS The method was successful.
86 * @see Tizen::Base::DateTime
88 virtual result Format(const Calendar& calendar, Tizen::Base::String& str) const;
96 * Applies the specified pattern string to the date format.
99 * @param[in] pattern The new date and time pattern for the date format
100 * @exception E_SUCCESS The method was successful.
101 * @exception E_INVALID_ARG The length of specified @c pattern is 0.
103 result ApplyPattern(const Tizen::Base::String& pattern);
107 * Gets a pattern string describing the date format.
110 * @return A String describing the date format
112 Tizen::Base::String GetPattern(void) const;
116 * Gets the date and time format symbols of the formatter.
119 * @return A pointer to DateTimeSymbols for the formatter instance
120 * @see SetDateTimeSymbols()
122 const DateTimeSymbols* GetDateTimeSymbols(void);
126 * Sets the date and time format symbols of the date format.
129 * @param[in] newSymbols The new date and time format symbols
130 * @see GetDateTimeSymbols()
132 void SetDateTimeSymbols(const DateTimeSymbols& newSymbols);
135 * Formats a DateTime into a date/time string and appends the result string to a given string buffer.
137 * @return An error code
138 * @param[in] date The DateTime object to format
139 * @param[in] pos On input: an alignment field, if desired @n
140 * On output: the offsets of the alignment field
141 * @param[out] str The String where the formatted string is to be appended
142 * @exception E_SUCCESS The method was successful.
143 * @see Tizen::Base::DateTime
145 result Format(const Tizen::Base::DateTime& date, _FieldPosition& pos, Tizen::Base::String& str) const;
149 * Formats a Calendar into a date/time string and appends the result string to a given string buffer.
151 * @return An error code
152 * @param[in] cal The Calendar object to format
153 * @param[in] pos On input: an alignment field, if desired @n
154 * On output: the offsets of the alignment field
155 * @param[out] str The String where the formatted string is to be appended
156 * @exception E_SUCCESS The method was successful.
159 result Format(const Calendar& calendar, _FieldPosition& pos, Tizen::Base::String& str) const;
161 static bool ValidateDateTimeStyle(DateTimeStyle dateTimeStyle);
163 _DateTimeFormatterImpl(const _DateTimeFormatterImpl& dateTimeFormatterImpl);
164 _DateTimeFormatterImpl& operator =(const _DateTimeFormatterImpl& dateTimeFormatterImpl);
166 U_ICU_NAMESPACE::SimpleDateFormat* GetIcuDateFormatterN(const Locale& locale, DateTimeStyle dateStyle, DateTimeStyle timeStyle);
169 DateTimeSymbols* __pSymbols;
170 U_ICU_NAMESPACE::SimpleDateFormat* __pIcuDateFormatter;
172 }; // _DateTimeFormatterImpl
176 #endif //_FLCL_INTERNAL_DATE_TIME_FORMATTER_IMPL_H_