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;
42 namespace Tizen { namespace Locales
45 class _DateTimeFormatterImpl
46 : public Tizen::Base::Object
50 _DateTimeFormatterImpl(void);
51 ~_DateTimeFormatterImpl(void);
54 static DateTimeFormatter* CreateInstanceN(const Locale& locale, DateTimeStyle dateStyle, DateTimeStyle timeStyle);
55 static DateTimeFormatter* CreateInstanceN(DateTimeStyle dateStyle, DateTimeStyle timeStyle);
61 * Formats a DateTime object into a date/time string and appends the resulting string to the specified string buffer.
64 * @return An error code
65 * @param[in] date The DateTime object to format
66 * @param[out] str The String to append the resulting string to
67 * @exception E_SUCCESS The method was successful.
68 * @remarks This method does not handle the time zone information, so "z" pattern always returns "GMT+00:00".
69 * @see Tizen::Base::DateTime
71 virtual result Format(const Tizen::Base::DateTime& date, Tizen::Base::String& str) const;
75 * Formats a Calendar object into a date/time string and appends the resulting string to the specified string buffer.
78 * @return An error code
79 * @param[in] calendar The Calendar object to format
80 * @param[out] str The String to append the resulting string to
81 * @exception E_SUCCESS The method was successful.
82 * @see Tizen::Base::DateTime
84 virtual result Format(const Calendar& calendar, Tizen::Base::String& str) const;
92 * Applies the specified pattern string to the date format.
95 * @param[in] pattern The new date and time pattern for the date format
96 * @exception E_SUCCESS The method was successful.
97 * @exception E_INVALID_ARG The length of specified @c pattern is 0.
99 result ApplyPattern(const Tizen::Base::String& pattern);
103 * Gets a pattern string describing the date format.
106 * @return A String describing the date format
108 Tizen::Base::String GetPattern(void) const;
112 * Gets the date and time format symbols of the formatter.
115 * @return A pointer to DateTimeSymbols for the formatter instance
116 * @see SetDateTimeSymbols()
118 const DateTimeSymbols* GetDateTimeSymbols(void) const;
122 * Sets the date and time format symbols of the date format.
125 * @param[in] newSymbols The new date and time format symbols
126 * @see GetDateTimeSymbols()
128 void SetDateTimeSymbols(const DateTimeSymbols& newSymbols);
131 * Formats a DateTime into a date/time string and appends the result string to a given string buffer.
133 * @return An error code
134 * @param[in] date The DateTime object to format
135 * @param[in] pos On input: an alignment field, if desired @n
136 * On output: the offsets of the alignment field
137 * @param[out] str The String where the formatted string is to be appended
138 * @exception E_SUCCESS The method was successful.
139 * @see Tizen::Base::DateTime
141 result Format(const Tizen::Base::DateTime& date, _FieldPosition& pos, Tizen::Base::String& str) const;
145 * Formats a Calendar into a date/time string and appends the result string to a given string buffer.
147 * @return An error code
148 * @param[in] cal The Calendar object to format
149 * @param[in] pos On input: an alignment field, if desired @n
150 * On output: the offsets of the alignment field
151 * @param[out] str The String where the formatted string is to be appended
152 * @exception E_SUCCESS The method was successful.
155 result Format(const Calendar& calendar, _FieldPosition& pos, Tizen::Base::String& str) const;
157 static bool ValidateDateTimeStyle(DateTimeStyle dateTimeStyle);
159 _DateTimeFormatterImpl(const _DateTimeFormatterImpl& dateTimeFormatterImpl);
160 _DateTimeFormatterImpl& operator =(const _DateTimeFormatterImpl& dateTimeFormatterImpl);
163 _LocaleData* __pLocaleData;
164 DateTimeSymbols* __pSymbols;
166 }; // _DateTimeFormatterImpl
170 #endif //_FLCL_INTERNAL_DATE_TIME_FORMATTER_IMPL_H_