OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 2007-2012, International Business Machines Corporation and * | 3 * Copyright (C) 2007-2014, International Business Machines Corporation and * |
4 * others. All Rights Reserved. * | 4 * others. All Rights Reserved. * |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 */ | 6 */ |
7 | 7 |
8 #ifndef RELDTFMT_H | 8 #ifndef RELDTFMT_H |
9 #define RELDTFMT_H | 9 #define RELDTFMT_H |
10 | 10 |
11 #include "unicode/utypes.h" | 11 #include "unicode/utypes.h" |
12 | 12 |
13 /** | 13 /** |
14 * \file | 14 * \file |
15 * \brief C++ API: Format and parse relative dates and times. | 15 * \brief C++ API: Format and parse relative dates and times. |
16 */ | 16 */ |
17 | 17 |
18 #if !UCONFIG_NO_FORMATTING | 18 #if !UCONFIG_NO_FORMATTING |
19 | 19 |
20 #include "unicode/datefmt.h" | 20 #include "unicode/datefmt.h" |
21 #include "unicode/smpdtfmt.h" | 21 #include "unicode/smpdtfmt.h" |
| 22 #include "unicode/brkiter.h" |
22 | 23 |
23 U_NAMESPACE_BEGIN | 24 U_NAMESPACE_BEGIN |
24 | 25 |
25 // forward declarations | 26 // forward declarations |
26 class DateFormatSymbols; | 27 class DateFormatSymbols; |
27 class MessageFormat; | 28 class MessageFormat; |
28 | 29 |
29 // internal structure used for caching strings | 30 // internal structure used for caching strings |
30 struct URelativeString; | 31 struct URelativeString; |
31 | 32 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 /** | 226 /** |
226 * Gets the date/time formatting symbols (this is an object carrying | 227 * Gets the date/time formatting symbols (this is an object carrying |
227 * the various strings and other symbols used in formatting: e.g., month | 228 * the various strings and other symbols used in formatting: e.g., month |
228 * names and abbreviations, time zone names, AM/PM strings, etc.) | 229 * names and abbreviations, time zone names, AM/PM strings, etc.) |
229 * @return a copy of the date-time formatting data associated | 230 * @return a copy of the date-time formatting data associated |
230 * with this date-time formatter. | 231 * with this date-time formatter. |
231 * @internal ICU 4.8 | 232 * @internal ICU 4.8 |
232 */ | 233 */ |
233 virtual const DateFormatSymbols* getDateFormatSymbols(void) const; | 234 virtual const DateFormatSymbols* getDateFormatSymbols(void) const; |
234 | 235 |
| 236 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since
it is virtual */ |
| 237 /** |
| 238 * Set a particular UDisplayContext value in the formatter, such as |
| 239 * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. Note: For getContext, see |
| 240 * DateFormat. |
| 241 * @param value The UDisplayContext value to set. |
| 242 * @param status Input/output status. If at entry this indicates a failure |
| 243 * status, the function will do nothing; otherwise this will b
e |
| 244 * updated with any new status from the function. |
| 245 * @internal ICU 53 |
| 246 */ |
| 247 virtual void setContext(UDisplayContext value, UErrorCode& status); |
235 | 248 |
236 private: | 249 private: |
237 SimpleDateFormat *fDateTimeFormatter; | 250 SimpleDateFormat *fDateTimeFormatter; |
238 UnicodeString fDatePattern; | 251 UnicodeString fDatePattern; |
239 UnicodeString fTimePattern; | 252 UnicodeString fTimePattern; |
240 MessageFormat *fCombinedFormat; // the {0} {1} format. | 253 MessageFormat *fCombinedFormat; // the {0} {1} format. |
241 | 254 |
242 UDateFormatStyle fDateStyle; | 255 UDateFormatStyle fDateStyle; |
243 Locale fLocale; | 256 Locale fLocale; |
244 | 257 |
245 int32_t fDayMin; // day id of lowest # | 258 int32_t fDayMin; // day id of lowest # |
246 int32_t fDayMax; // day id of highest # | 259 int32_t fDayMax; // day id of highest # |
247 int32_t fDatesLen; // Length of array | 260 int32_t fDatesLen; // Length of array |
248 URelativeString *fDates; // array of strings | 261 URelativeString *fDates; // array of strings |
249 | 262 |
| 263 UBool fCombinedHasDateAtStart; |
| 264 UBool fCapitalizationInfoSet; |
| 265 UBool fCapitalizationOfRelativeUnitsForUIListMenu; |
| 266 UBool fCapitalizationOfRelativeUnitsForStandAlone; |
| 267 BreakIterator* fCapitalizationBrkIter; |
250 | 268 |
251 /** | 269 /** |
252 * Get the string at a specific offset. | 270 * Get the string at a specific offset. |
253 * @param day day offset ( -1, 0, 1, etc.. ) | 271 * @param day day offset ( -1, 0, 1, etc.. ) |
254 * @param len on output, length of string. | 272 * @param len on output, length of string. |
255 * @return the string, or NULL if none at that location. | 273 * @return the string, or NULL if none at that location. |
256 */ | 274 */ |
257 const UChar *getStringForDay(int32_t day, int32_t &len, UErrorCode &status)
const; | 275 const UChar *getStringForDay(int32_t day, int32_t &len, UErrorCode &status)
const; |
258 | 276 |
259 /** | 277 /** |
260 * Load the Date string array | 278 * Load the Date string array |
261 */ | 279 */ |
262 void loadDates(UErrorCode &status); | 280 void loadDates(UErrorCode &status); |
263 | 281 |
264 /** | 282 /** |
| 283 * Set fCapitalizationOfRelativeUnitsForUIListMenu, fCapitalizationOfRelativ
eUnitsForStandAlone |
| 284 */ |
| 285 void initCapitalizationContextInfo(const Locale& thelocale); |
| 286 |
| 287 /** |
265 * @return the number of days in "until-now" | 288 * @return the number of days in "until-now" |
266 */ | 289 */ |
267 static int32_t dayDifference(Calendar &until, UErrorCode &status); | 290 static int32_t dayDifference(Calendar &until, UErrorCode &status); |
268 | 291 |
269 /** | 292 /** |
270 * initializes fCalendar from parameters. Returns fCalendar as a convenienc
e. | 293 * initializes fCalendar from parameters. Returns fCalendar as a convenienc
e. |
271 * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDefault
(). | 294 * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDefault
(). |
272 * @param locale Locale of the calendar | 295 * @param locale Locale of the calendar |
273 * @param status Error code | 296 * @param status Error code |
274 * @return the newly constructed fCalendar | 297 * @return the newly constructed fCalendar |
(...skipping 29 matching lines...) Expand all Loading... |
304 virtual UClassID getDynamicClassID(void) const; | 327 virtual UClassID getDynamicClassID(void) const; |
305 }; | 328 }; |
306 | 329 |
307 | 330 |
308 U_NAMESPACE_END | 331 U_NAMESPACE_END |
309 | 332 |
310 #endif /* #if !UCONFIG_NO_FORMATTING */ | 333 #endif /* #if !UCONFIG_NO_FORMATTING */ |
311 | 334 |
312 #endif // RELDTFMT_H | 335 #endif // RELDTFMT_H |
313 //eof | 336 //eof |
OLD | NEW |