annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/dtfmtsym.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 // © 2016 and later: Unicode, Inc. and others.
jpayne@69 2 // License & terms of use: http://www.unicode.org/copyright.html
jpayne@69 3 /*
jpayne@69 4 ********************************************************************************
jpayne@69 5 * Copyright (C) 1997-2016, International Business Machines
jpayne@69 6 * Corporation and others. All Rights Reserved.
jpayne@69 7 ********************************************************************************
jpayne@69 8 *
jpayne@69 9 * File DTFMTSYM.H
jpayne@69 10 *
jpayne@69 11 * Modification History:
jpayne@69 12 *
jpayne@69 13 * Date Name Description
jpayne@69 14 * 02/19/97 aliu Converted from java.
jpayne@69 15 * 07/21/98 stephen Added getZoneIndex()
jpayne@69 16 * Changed to match C++ conventions
jpayne@69 17 ********************************************************************************
jpayne@69 18 */
jpayne@69 19
jpayne@69 20 #ifndef DTFMTSYM_H
jpayne@69 21 #define DTFMTSYM_H
jpayne@69 22
jpayne@69 23 #include "unicode/utypes.h"
jpayne@69 24
jpayne@69 25 #if U_SHOW_CPLUSPLUS_API
jpayne@69 26
jpayne@69 27 #if !UCONFIG_NO_FORMATTING
jpayne@69 28
jpayne@69 29 #include "unicode/calendar.h"
jpayne@69 30 #include "unicode/strenum.h"
jpayne@69 31 #include "unicode/uobject.h"
jpayne@69 32 #include "unicode/locid.h"
jpayne@69 33 #include "unicode/udat.h"
jpayne@69 34 #include "unicode/ures.h"
jpayne@69 35
jpayne@69 36 /**
jpayne@69 37 * \file
jpayne@69 38 * \brief C++ API: Symbols for formatting dates.
jpayne@69 39 */
jpayne@69 40
jpayne@69 41 U_NAMESPACE_BEGIN
jpayne@69 42
jpayne@69 43 /* forward declaration */
jpayne@69 44 class SimpleDateFormat;
jpayne@69 45 class Hashtable;
jpayne@69 46
jpayne@69 47 /**
jpayne@69 48 * DateFormatSymbols is a public class for encapsulating localizable date-time
jpayne@69 49 * formatting data -- including timezone data. DateFormatSymbols is used by
jpayne@69 50 * DateFormat and SimpleDateFormat.
jpayne@69 51 * <P>
jpayne@69 52 * Rather than first creating a DateFormatSymbols to get a date-time formatter
jpayne@69 53 * by using a SimpleDateFormat constructor, clients are encouraged to create a
jpayne@69 54 * date-time formatter using the getTimeInstance(), getDateInstance(), or
jpayne@69 55 * getDateTimeInstance() method in DateFormat. Each of these methods can return a
jpayne@69 56 * date/time formatter initialized with a default format pattern along with the
jpayne@69 57 * date-time formatting data for a given or default locale. After a formatter is
jpayne@69 58 * created, clients may modify the format pattern using the setPattern function
jpayne@69 59 * as so desired. For more information on using these formatter factory
jpayne@69 60 * functions, see DateFormat.
jpayne@69 61 * <P>
jpayne@69 62 * If clients decide to create a date-time formatter with a particular format
jpayne@69 63 * pattern and locale, they can do so with new SimpleDateFormat(aPattern,
jpayne@69 64 * new DateFormatSymbols(aLocale)). This will load the appropriate date-time
jpayne@69 65 * formatting data from the locale.
jpayne@69 66 * <P>
jpayne@69 67 * DateFormatSymbols objects are clonable. When clients obtain a
jpayne@69 68 * DateFormatSymbols object, they can feel free to modify the date-time
jpayne@69 69 * formatting data as necessary. For instance, clients can
jpayne@69 70 * replace the localized date-time format pattern characters with the ones that
jpayne@69 71 * they feel easy to remember. Or they can change the representative cities
jpayne@69 72 * originally picked by default to using their favorite ones.
jpayne@69 73 * <P>
jpayne@69 74 * DateFormatSymbols are not expected to be subclassed. Data for a calendar is
jpayne@69 75 * loaded out of resource bundles. The 'type' parameter indicates the type of
jpayne@69 76 * calendar, for example, "gregorian" or "japanese". If the type is not gregorian
jpayne@69 77 * (or NULL, or an empty string) then the type is appended to the resource name,
jpayne@69 78 * for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japanese' did
jpayne@69 79 * not exist (even in root), then this class will fall back to just 'Eras', that is,
jpayne@69 80 * Gregorian data. Therefore, the calendar implementor MUST ensure that the root
jpayne@69 81 * locale at least contains any resources that are to be particularized for the
jpayne@69 82 * calendar type.
jpayne@69 83 */
jpayne@69 84 class U_I18N_API DateFormatSymbols U_FINAL : public UObject {
jpayne@69 85 public:
jpayne@69 86 /**
jpayne@69 87 * Construct a DateFormatSymbols object by loading format data from
jpayne@69 88 * resources for the default locale, in the default calendar (Gregorian).
jpayne@69 89 * <P>
jpayne@69 90 * NOTE: This constructor will never fail; if it cannot get resource
jpayne@69 91 * data for the default locale, it will return a last-resort object
jpayne@69 92 * based on hard-coded strings.
jpayne@69 93 *
jpayne@69 94 * @param status Status code. Failure
jpayne@69 95 * results if the resources for the default cannot be
jpayne@69 96 * found or cannot be loaded
jpayne@69 97 * @stable ICU 2.0
jpayne@69 98 */
jpayne@69 99 DateFormatSymbols(UErrorCode& status);
jpayne@69 100
jpayne@69 101 /**
jpayne@69 102 * Construct a DateFormatSymbols object by loading format data from
jpayne@69 103 * resources for the given locale, in the default calendar (Gregorian).
jpayne@69 104 *
jpayne@69 105 * @param locale Locale to load format data from.
jpayne@69 106 * @param status Status code. Failure
jpayne@69 107 * results if the resources for the locale cannot be
jpayne@69 108 * found or cannot be loaded
jpayne@69 109 * @stable ICU 2.0
jpayne@69 110 */
jpayne@69 111 DateFormatSymbols(const Locale& locale,
jpayne@69 112 UErrorCode& status);
jpayne@69 113
jpayne@69 114 #ifndef U_HIDE_INTERNAL_API
jpayne@69 115 /**
jpayne@69 116 * Construct a DateFormatSymbols object by loading format data from
jpayne@69 117 * resources for the default locale, in the default calendar (Gregorian).
jpayne@69 118 * <P>
jpayne@69 119 * NOTE: This constructor will never fail; if it cannot get resource
jpayne@69 120 * data for the default locale, it will return a last-resort object
jpayne@69 121 * based on hard-coded strings.
jpayne@69 122 *
jpayne@69 123 * @param type Type of calendar (as returned by Calendar::getType).
jpayne@69 124 * Will be used to access the correct set of strings.
jpayne@69 125 * (NULL or empty string defaults to "gregorian".)
jpayne@69 126 * @param status Status code. Failure
jpayne@69 127 * results if the resources for the default cannot be
jpayne@69 128 * found or cannot be loaded
jpayne@69 129 * @internal
jpayne@69 130 */
jpayne@69 131 DateFormatSymbols(const char *type, UErrorCode& status);
jpayne@69 132
jpayne@69 133 /**
jpayne@69 134 * Construct a DateFormatSymbols object by loading format data from
jpayne@69 135 * resources for the given locale, in the default calendar (Gregorian).
jpayne@69 136 *
jpayne@69 137 * @param locale Locale to load format data from.
jpayne@69 138 * @param type Type of calendar (as returned by Calendar::getType).
jpayne@69 139 * Will be used to access the correct set of strings.
jpayne@69 140 * (NULL or empty string defaults to "gregorian".)
jpayne@69 141 * @param status Status code. Failure
jpayne@69 142 * results if the resources for the locale cannot be
jpayne@69 143 * found or cannot be loaded
jpayne@69 144 * @internal
jpayne@69 145 */
jpayne@69 146 DateFormatSymbols(const Locale& locale,
jpayne@69 147 const char *type,
jpayne@69 148 UErrorCode& status);
jpayne@69 149 #endif /* U_HIDE_INTERNAL_API */
jpayne@69 150
jpayne@69 151 /**
jpayne@69 152 * Copy constructor.
jpayne@69 153 * @stable ICU 2.0
jpayne@69 154 */
jpayne@69 155 DateFormatSymbols(const DateFormatSymbols&);
jpayne@69 156
jpayne@69 157 /**
jpayne@69 158 * Assignment operator.
jpayne@69 159 * @stable ICU 2.0
jpayne@69 160 */
jpayne@69 161 DateFormatSymbols& operator=(const DateFormatSymbols&);
jpayne@69 162
jpayne@69 163 /**
jpayne@69 164 * Destructor. This is nonvirtual because this class is not designed to be
jpayne@69 165 * subclassed.
jpayne@69 166 * @stable ICU 2.0
jpayne@69 167 */
jpayne@69 168 virtual ~DateFormatSymbols();
jpayne@69 169
jpayne@69 170 /**
jpayne@69 171 * Return true if another object is semantically equal to this one.
jpayne@69 172 *
jpayne@69 173 * @param other the DateFormatSymbols object to be compared with.
jpayne@69 174 * @return true if other is semantically equal to this.
jpayne@69 175 * @stable ICU 2.0
jpayne@69 176 */
jpayne@69 177 UBool operator==(const DateFormatSymbols& other) const;
jpayne@69 178
jpayne@69 179 /**
jpayne@69 180 * Return true if another object is semantically unequal to this one.
jpayne@69 181 *
jpayne@69 182 * @param other the DateFormatSymbols object to be compared with.
jpayne@69 183 * @return true if other is semantically unequal to this.
jpayne@69 184 * @stable ICU 2.0
jpayne@69 185 */
jpayne@69 186 UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
jpayne@69 187
jpayne@69 188 /**
jpayne@69 189 * Gets abbreviated era strings. For example: "AD" and "BC".
jpayne@69 190 *
jpayne@69 191 * @param count Filled in with length of the array.
jpayne@69 192 * @return the era strings.
jpayne@69 193 * @stable ICU 2.0
jpayne@69 194 */
jpayne@69 195 const UnicodeString* getEras(int32_t& count) const;
jpayne@69 196
jpayne@69 197 /**
jpayne@69 198 * Sets abbreviated era strings. For example: "AD" and "BC".
jpayne@69 199 * @param eras Array of era strings (DateFormatSymbols retains ownership.)
jpayne@69 200 * @param count Filled in with length of the array.
jpayne@69 201 * @stable ICU 2.0
jpayne@69 202 */
jpayne@69 203 void setEras(const UnicodeString* eras, int32_t count);
jpayne@69 204
jpayne@69 205 /**
jpayne@69 206 * Gets era name strings. For example: "Anno Domini" and "Before Christ".
jpayne@69 207 *
jpayne@69 208 * @param count Filled in with length of the array.
jpayne@69 209 * @return the era name strings.
jpayne@69 210 * @stable ICU 3.4
jpayne@69 211 */
jpayne@69 212 const UnicodeString* getEraNames(int32_t& count) const;
jpayne@69 213
jpayne@69 214 /**
jpayne@69 215 * Sets era name strings. For example: "Anno Domini" and "Before Christ".
jpayne@69 216 * @param eraNames Array of era name strings (DateFormatSymbols retains ownership.)
jpayne@69 217 * @param count Filled in with length of the array.
jpayne@69 218 * @stable ICU 3.6
jpayne@69 219 */
jpayne@69 220 void setEraNames(const UnicodeString* eraNames, int32_t count);
jpayne@69 221
jpayne@69 222 /**
jpayne@69 223 * Gets narrow era strings. For example: "A" and "B".
jpayne@69 224 *
jpayne@69 225 * @param count Filled in with length of the array.
jpayne@69 226 * @return the narrow era strings.
jpayne@69 227 * @stable ICU 4.2
jpayne@69 228 */
jpayne@69 229 const UnicodeString* getNarrowEras(int32_t& count) const;
jpayne@69 230
jpayne@69 231 /**
jpayne@69 232 * Sets narrow era strings. For example: "A" and "B".
jpayne@69 233 * @param narrowEras Array of narrow era strings (DateFormatSymbols retains ownership.)
jpayne@69 234 * @param count Filled in with length of the array.
jpayne@69 235 * @stable ICU 4.2
jpayne@69 236 */
jpayne@69 237 void setNarrowEras(const UnicodeString* narrowEras, int32_t count);
jpayne@69 238
jpayne@69 239 /**
jpayne@69 240 * Gets month strings. For example: "January", "February", etc.
jpayne@69 241 * @param count Filled in with length of the array.
jpayne@69 242 * @return the month strings. (DateFormatSymbols retains ownership.)
jpayne@69 243 * @stable ICU 2.0
jpayne@69 244 */
jpayne@69 245 const UnicodeString* getMonths(int32_t& count) const;
jpayne@69 246
jpayne@69 247 /**
jpayne@69 248 * Sets month strings. For example: "January", "February", etc.
jpayne@69 249 *
jpayne@69 250 * @param months the new month strings. (not adopted; caller retains ownership)
jpayne@69 251 * @param count Filled in with length of the array.
jpayne@69 252 * @stable ICU 2.0
jpayne@69 253 */
jpayne@69 254 void setMonths(const UnicodeString* months, int32_t count);
jpayne@69 255
jpayne@69 256 /**
jpayne@69 257 * Gets short month strings. For example: "Jan", "Feb", etc.
jpayne@69 258 *
jpayne@69 259 * @param count Filled in with length of the array.
jpayne@69 260 * @return the short month strings. (DateFormatSymbols retains ownership.)
jpayne@69 261 * @stable ICU 2.0
jpayne@69 262 */
jpayne@69 263 const UnicodeString* getShortMonths(int32_t& count) const;
jpayne@69 264
jpayne@69 265 /**
jpayne@69 266 * Sets short month strings. For example: "Jan", "Feb", etc.
jpayne@69 267 * @param count Filled in with length of the array.
jpayne@69 268 * @param shortMonths the new short month strings. (not adopted; caller retains ownership)
jpayne@69 269 * @stable ICU 2.0
jpayne@69 270 */
jpayne@69 271 void setShortMonths(const UnicodeString* shortMonths, int32_t count);
jpayne@69 272
jpayne@69 273 /**
jpayne@69 274 * Selector for date formatting context
jpayne@69 275 * @stable ICU 3.6
jpayne@69 276 */
jpayne@69 277 enum DtContextType {
jpayne@69 278 FORMAT,
jpayne@69 279 STANDALONE,
jpayne@69 280 #ifndef U_HIDE_DEPRECATED_API
jpayne@69 281 /**
jpayne@69 282 * One more than the highest normal DtContextType value.
jpayne@69 283 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
jpayne@69 284 */
jpayne@69 285 DT_CONTEXT_COUNT
jpayne@69 286 #endif // U_HIDE_DEPRECATED_API
jpayne@69 287 };
jpayne@69 288
jpayne@69 289 /**
jpayne@69 290 * Selector for date formatting width
jpayne@69 291 * @stable ICU 3.6
jpayne@69 292 */
jpayne@69 293 enum DtWidthType {
jpayne@69 294 ABBREVIATED,
jpayne@69 295 WIDE,
jpayne@69 296 NARROW,
jpayne@69 297 /**
jpayne@69 298 * Short width is currently only supported for weekday names.
jpayne@69 299 * @stable ICU 51
jpayne@69 300 */
jpayne@69 301 SHORT,
jpayne@69 302 #ifndef U_HIDE_DEPRECATED_API
jpayne@69 303 /**
jpayne@69 304 * One more than the highest normal DtWidthType value.
jpayne@69 305 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
jpayne@69 306 */
jpayne@69 307 DT_WIDTH_COUNT = 4
jpayne@69 308 #endif // U_HIDE_DEPRECATED_API
jpayne@69 309 };
jpayne@69 310
jpayne@69 311 /**
jpayne@69 312 * Gets month strings by width and context. For example: "January", "February", etc.
jpayne@69 313 * @param count Filled in with length of the array.
jpayne@69 314 * @param context The formatting context, either FORMAT or STANDALONE
jpayne@69 315 * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
jpayne@69 316 * @return the month strings. (DateFormatSymbols retains ownership.)
jpayne@69 317 * @stable ICU 3.4
jpayne@69 318 */
jpayne@69 319 const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
jpayne@69 320
jpayne@69 321 /**
jpayne@69 322 * Sets month strings by width and context. For example: "January", "February", etc.
jpayne@69 323 *
jpayne@69 324 * @param months The new month strings. (not adopted; caller retains ownership)
jpayne@69 325 * @param count Filled in with length of the array.
jpayne@69 326 * @param context The formatting context, either FORMAT or STANDALONE
jpayne@69 327 * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
jpayne@69 328 * @stable ICU 3.6
jpayne@69 329 */
jpayne@69 330 void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
jpayne@69 331
jpayne@69 332 /**
jpayne@69 333 * Gets wide weekday strings. For example: "Sunday", "Monday", etc.
jpayne@69 334 * @param count Filled in with length of the array.
jpayne@69 335 * @return the weekday strings. (DateFormatSymbols retains ownership.)
jpayne@69 336 * @stable ICU 2.0
jpayne@69 337 */
jpayne@69 338 const UnicodeString* getWeekdays(int32_t& count) const;
jpayne@69 339
jpayne@69 340
jpayne@69 341 /**
jpayne@69 342 * Sets wide weekday strings. For example: "Sunday", "Monday", etc.
jpayne@69 343 * @param weekdays the new weekday strings. (not adopted; caller retains ownership)
jpayne@69 344 * @param count Filled in with length of the array.
jpayne@69 345 * @stable ICU 2.0
jpayne@69 346 */
jpayne@69 347 void setWeekdays(const UnicodeString* weekdays, int32_t count);
jpayne@69 348
jpayne@69 349 /**
jpayne@69 350 * Gets abbreviated weekday strings. For example: "Sun", "Mon", etc. (Note: The method name is
jpayne@69 351 * misleading; it does not get the CLDR-style "short" weekday strings, e.g. "Su", "Mo", etc.)
jpayne@69 352 * @param count Filled in with length of the array.
jpayne@69 353 * @return the abbreviated weekday strings. (DateFormatSymbols retains ownership.)
jpayne@69 354 * @stable ICU 2.0
jpayne@69 355 */
jpayne@69 356 const UnicodeString* getShortWeekdays(int32_t& count) const;
jpayne@69 357
jpayne@69 358 /**
jpayne@69 359 * Sets abbreviated weekday strings. For example: "Sun", "Mon", etc. (Note: The method name is
jpayne@69 360 * misleading; it does not set the CLDR-style "short" weekday strings, e.g. "Su", "Mo", etc.)
jpayne@69 361 * @param abbrevWeekdays the new abbreviated weekday strings. (not adopted; caller retains ownership)
jpayne@69 362 * @param count Filled in with length of the array.
jpayne@69 363 * @stable ICU 2.0
jpayne@69 364 */
jpayne@69 365 void setShortWeekdays(const UnicodeString* abbrevWeekdays, int32_t count);
jpayne@69 366
jpayne@69 367 /**
jpayne@69 368 * Gets weekday strings by width and context. For example: "Sunday", "Monday", etc.
jpayne@69 369 * @param count Filled in with length of the array.
jpayne@69 370 * @param context The formatting context, either FORMAT or STANDALONE
jpayne@69 371 * @param width The width of returned strings, either WIDE, ABBREVIATED, SHORT, or NARROW
jpayne@69 372 * @return the month strings. (DateFormatSymbols retains ownership.)
jpayne@69 373 * @stable ICU 3.4
jpayne@69 374 */
jpayne@69 375 const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
jpayne@69 376
jpayne@69 377 /**
jpayne@69 378 * Sets weekday strings by width and context. For example: "Sunday", "Monday", etc.
jpayne@69 379 * @param weekdays The new weekday strings. (not adopted; caller retains ownership)
jpayne@69 380 * @param count Filled in with length of the array.
jpayne@69 381 * @param context The formatting context, either FORMAT or STANDALONE
jpayne@69 382 * @param width The width of returned strings, either WIDE, ABBREVIATED, SHORT, or NARROW
jpayne@69 383 * @stable ICU 3.6
jpayne@69 384 */
jpayne@69 385 void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
jpayne@69 386
jpayne@69 387 /**
jpayne@69 388 * Gets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc.
jpayne@69 389 * @param count Filled in with length of the array.
jpayne@69 390 * @param context The formatting context, either FORMAT or STANDALONE
jpayne@69 391 * @param width The width of returned strings, either WIDE or ABBREVIATED. There
jpayne@69 392 * are no NARROW quarters.
jpayne@69 393 * @return the quarter strings. (DateFormatSymbols retains ownership.)
jpayne@69 394 * @stable ICU 3.6
jpayne@69 395 */
jpayne@69 396 const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
jpayne@69 397
jpayne@69 398 /**
jpayne@69 399 * Sets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc.
jpayne@69 400 *
jpayne@69 401 * @param quarters The new quarter strings. (not adopted; caller retains ownership)
jpayne@69 402 * @param count Filled in with length of the array.
jpayne@69 403 * @param context The formatting context, either FORMAT or STANDALONE
jpayne@69 404 * @param width The width of returned strings, either WIDE or ABBREVIATED. There
jpayne@69 405 * are no NARROW quarters.
jpayne@69 406 * @stable ICU 3.6
jpayne@69 407 */
jpayne@69 408 void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
jpayne@69 409
jpayne@69 410 /**
jpayne@69 411 * Gets AM/PM strings. For example: "AM" and "PM".
jpayne@69 412 * @param count Filled in with length of the array.
jpayne@69 413 * @return the weekday strings. (DateFormatSymbols retains ownership.)
jpayne@69 414 * @stable ICU 2.0
jpayne@69 415 */
jpayne@69 416 const UnicodeString* getAmPmStrings(int32_t& count) const;
jpayne@69 417
jpayne@69 418 /**
jpayne@69 419 * Sets ampm strings. For example: "AM" and "PM".
jpayne@69 420 * @param ampms the new ampm strings. (not adopted; caller retains ownership)
jpayne@69 421 * @param count Filled in with length of the array.
jpayne@69 422 * @stable ICU 2.0
jpayne@69 423 */
jpayne@69 424 void setAmPmStrings(const UnicodeString* ampms, int32_t count);
jpayne@69 425
jpayne@69 426 #ifndef U_HIDE_INTERNAL_API
jpayne@69 427 /**
jpayne@69 428 * This default time separator is used for formatting when the locale
jpayne@69 429 * doesn't specify any time separator, and always recognized when parsing.
jpayne@69 430 * @internal
jpayne@69 431 */
jpayne@69 432 static const char16_t DEFAULT_TIME_SEPARATOR = 0x003a; // ':'
jpayne@69 433
jpayne@69 434 /**
jpayne@69 435 * This alternate time separator is always recognized when parsing.
jpayne@69 436 * @internal
jpayne@69 437 */
jpayne@69 438 static const char16_t ALTERNATE_TIME_SEPARATOR = 0x002e; // '.'
jpayne@69 439
jpayne@69 440 /**
jpayne@69 441 * Gets the time separator string. For example: ":".
jpayne@69 442 * @param result Output param which will receive the time separator string.
jpayne@69 443 * @return A reference to 'result'.
jpayne@69 444 * @internal
jpayne@69 445 */
jpayne@69 446 UnicodeString& getTimeSeparatorString(UnicodeString& result) const;
jpayne@69 447
jpayne@69 448 /**
jpayne@69 449 * Sets the time separator string. For example: ":".
jpayne@69 450 * @param newTimeSeparator the new time separator string.
jpayne@69 451 * @internal
jpayne@69 452 */
jpayne@69 453 void setTimeSeparatorString(const UnicodeString& newTimeSeparator);
jpayne@69 454 #endif /* U_HIDE_INTERNAL_API */
jpayne@69 455
jpayne@69 456 /**
jpayne@69 457 * Gets cyclic year name strings if the calendar has them, by width and context.
jpayne@69 458 * For example: "jia-zi", "yi-chou", etc.
jpayne@69 459 * @param count Filled in with length of the array.
jpayne@69 460 * @param context The usage context: FORMAT, STANDALONE.
jpayne@69 461 * @param width The requested name width: WIDE, ABBREVIATED, NARROW.
jpayne@69 462 * @return The year name strings (DateFormatSymbols retains ownership),
jpayne@69 463 * or null if they are not available for this calendar.
jpayne@69 464 * @stable ICU 54
jpayne@69 465 */
jpayne@69 466 const UnicodeString* getYearNames(int32_t& count,
jpayne@69 467 DtContextType context, DtWidthType width) const;
jpayne@69 468
jpayne@69 469 /**
jpayne@69 470 * Sets cyclic year name strings by width and context. For example: "jia-zi", "yi-chou", etc.
jpayne@69 471 *
jpayne@69 472 * @param yearNames The new cyclic year name strings (not adopted; caller retains ownership).
jpayne@69 473 * @param count The length of the array.
jpayne@69 474 * @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported).
jpayne@69 475 * @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported).
jpayne@69 476 * @stable ICU 54
jpayne@69 477 */
jpayne@69 478 void setYearNames(const UnicodeString* yearNames, int32_t count,
jpayne@69 479 DtContextType context, DtWidthType width);
jpayne@69 480
jpayne@69 481 /**
jpayne@69 482 * Gets calendar zodiac name strings if the calendar has them, by width and context.
jpayne@69 483 * For example: "Rat", "Ox", "Tiger", etc.
jpayne@69 484 * @param count Filled in with length of the array.
jpayne@69 485 * @param context The usage context: FORMAT, STANDALONE.
jpayne@69 486 * @param width The requested name width: WIDE, ABBREVIATED, NARROW.
jpayne@69 487 * @return The zodiac name strings (DateFormatSymbols retains ownership),
jpayne@69 488 * or null if they are not available for this calendar.
jpayne@69 489 * @stable ICU 54
jpayne@69 490 */
jpayne@69 491 const UnicodeString* getZodiacNames(int32_t& count,
jpayne@69 492 DtContextType context, DtWidthType width) const;
jpayne@69 493
jpayne@69 494 /**
jpayne@69 495 * Sets calendar zodiac name strings by width and context. For example: "Rat", "Ox", "Tiger", etc.
jpayne@69 496 *
jpayne@69 497 * @param zodiacNames The new zodiac name strings (not adopted; caller retains ownership).
jpayne@69 498 * @param count The length of the array.
jpayne@69 499 * @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported).
jpayne@69 500 * @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported).
jpayne@69 501 * @stable ICU 54
jpayne@69 502 */
jpayne@69 503 void setZodiacNames(const UnicodeString* zodiacNames, int32_t count,
jpayne@69 504 DtContextType context, DtWidthType width);
jpayne@69 505
jpayne@69 506 #ifndef U_HIDE_INTERNAL_API
jpayne@69 507 /**
jpayne@69 508 * Somewhat temporary constants for leap month pattern types, adequate for supporting
jpayne@69 509 * just leap month patterns as needed for Chinese lunar calendar.
jpayne@69 510 * Eventually we will add full support for different month pattern types (needed for
jpayne@69 511 * other calendars such as Hindu) at which point this approach will be replaced by a
jpayne@69 512 * more complete approach.
jpayne@69 513 * @internal
jpayne@69 514 */
jpayne@69 515 enum EMonthPatternType
jpayne@69 516 {
jpayne@69 517 kLeapMonthPatternFormatWide,
jpayne@69 518 kLeapMonthPatternFormatAbbrev,
jpayne@69 519 kLeapMonthPatternFormatNarrow,
jpayne@69 520 kLeapMonthPatternStandaloneWide,
jpayne@69 521 kLeapMonthPatternStandaloneAbbrev,
jpayne@69 522 kLeapMonthPatternStandaloneNarrow,
jpayne@69 523 kLeapMonthPatternNumeric,
jpayne@69 524 kMonthPatternsCount
jpayne@69 525 };
jpayne@69 526
jpayne@69 527 /**
jpayne@69 528 * Somewhat temporary function for getting complete set of leap month patterns for all
jpayne@69 529 * contexts & widths, indexed by EMonthPatternType values. Returns NULL if calendar
jpayne@69 530 * does not have leap month patterns. Note, there is currently no setter for this.
jpayne@69 531 * Eventually we will add full support for different month pattern types (needed for
jpayne@69 532 * other calendars such as Hindu) at which point this approach will be replaced by a
jpayne@69 533 * more complete approach.
jpayne@69 534 * @param count Filled in with length of the array (may be 0).
jpayne@69 535 * @return The leap month patterns (DateFormatSymbols retains ownership).
jpayne@69 536 * May be NULL if there are no leap month patterns for this calendar.
jpayne@69 537 * @internal
jpayne@69 538 */
jpayne@69 539 const UnicodeString* getLeapMonthPatterns(int32_t& count) const;
jpayne@69 540
jpayne@69 541 #endif /* U_HIDE_INTERNAL_API */
jpayne@69 542
jpayne@69 543 #ifndef U_HIDE_DEPRECATED_API
jpayne@69 544 /**
jpayne@69 545 * Gets timezone strings. These strings are stored in a 2-dimensional array.
jpayne@69 546 * @param rowCount Output param to receive number of rows.
jpayne@69 547 * @param columnCount Output param to receive number of columns.
jpayne@69 548 * @return The timezone strings as a 2-d array. (DateFormatSymbols retains ownership.)
jpayne@69 549 * @deprecated ICU 3.6
jpayne@69 550 */
jpayne@69 551 const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
jpayne@69 552 #endif /* U_HIDE_DEPRECATED_API */
jpayne@69 553
jpayne@69 554 /**
jpayne@69 555 * Sets timezone strings. These strings are stored in a 2-dimensional array.
jpayne@69 556 * <p><b>Note:</b> SimpleDateFormat no longer use the zone strings stored in
jpayne@69 557 * a DateFormatSymbols. Therefore, the time zone strings set by this mthod
jpayne@69 558 * have no effects in an instance of SimpleDateFormat for formatting time
jpayne@69 559 * zones.
jpayne@69 560 * @param strings The timezone strings as a 2-d array to be copied. (not adopted; caller retains ownership)
jpayne@69 561 * @param rowCount The number of rows (count of first index).
jpayne@69 562 * @param columnCount The number of columns (count of second index).
jpayne@69 563 * @stable ICU 2.0
jpayne@69 564 */
jpayne@69 565 void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
jpayne@69 566
jpayne@69 567 /**
jpayne@69 568 * Get the non-localized date-time pattern characters.
jpayne@69 569 * @return the non-localized date-time pattern characters
jpayne@69 570 * @stable ICU 2.0
jpayne@69 571 */
jpayne@69 572 static const char16_t * U_EXPORT2 getPatternUChars(void);
jpayne@69 573
jpayne@69 574 /**
jpayne@69 575 * Gets localized date-time pattern characters. For example: 'u', 't', etc.
jpayne@69 576 * <p>
jpayne@69 577 * Note: ICU no longer provides localized date-time pattern characters for a locale
jpayne@69 578 * starting ICU 3.8. This method returns the non-localized date-time pattern
jpayne@69 579 * characters unless user defined localized data is set by setLocalPatternChars.
jpayne@69 580 * @param result Output param which will receive the localized date-time pattern characters.
jpayne@69 581 * @return A reference to 'result'.
jpayne@69 582 * @stable ICU 2.0
jpayne@69 583 */
jpayne@69 584 UnicodeString& getLocalPatternChars(UnicodeString& result) const;
jpayne@69 585
jpayne@69 586 /**
jpayne@69 587 * Sets localized date-time pattern characters. For example: 'u', 't', etc.
jpayne@69 588 * @param newLocalPatternChars the new localized date-time
jpayne@69 589 * pattern characters.
jpayne@69 590 * @stable ICU 2.0
jpayne@69 591 */
jpayne@69 592 void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
jpayne@69 593
jpayne@69 594 /**
jpayne@69 595 * Returns the locale for this object. Two flavors are available:
jpayne@69 596 * valid and actual locale.
jpayne@69 597 * @stable ICU 2.8
jpayne@69 598 */
jpayne@69 599 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
jpayne@69 600
jpayne@69 601 /* The following type and kCapContextUsageTypeCount cannot be #ifndef U_HIDE_INTERNAL_API,
jpayne@69 602 they are needed for .h file declarations. */
jpayne@69 603 /**
jpayne@69 604 * Constants for capitalization context usage types.
jpayne@69 605 * @internal
jpayne@69 606 */
jpayne@69 607 enum ECapitalizationContextUsageType
jpayne@69 608 {
jpayne@69 609 #ifndef U_HIDE_INTERNAL_API
jpayne@69 610 kCapContextUsageOther = 0,
jpayne@69 611 kCapContextUsageMonthFormat, /* except narrow */
jpayne@69 612 kCapContextUsageMonthStandalone, /* except narrow */
jpayne@69 613 kCapContextUsageMonthNarrow,
jpayne@69 614 kCapContextUsageDayFormat, /* except narrow */
jpayne@69 615 kCapContextUsageDayStandalone, /* except narrow */
jpayne@69 616 kCapContextUsageDayNarrow,
jpayne@69 617 kCapContextUsageEraWide,
jpayne@69 618 kCapContextUsageEraAbbrev,
jpayne@69 619 kCapContextUsageEraNarrow,
jpayne@69 620 kCapContextUsageZoneLong,
jpayne@69 621 kCapContextUsageZoneShort,
jpayne@69 622 kCapContextUsageMetazoneLong,
jpayne@69 623 kCapContextUsageMetazoneShort,
jpayne@69 624 #endif /* U_HIDE_INTERNAL_API */
jpayne@69 625 kCapContextUsageTypeCount = 14
jpayne@69 626 };
jpayne@69 627
jpayne@69 628 /**
jpayne@69 629 * ICU "poor man's RTTI", returns a UClassID for the actual class.
jpayne@69 630 *
jpayne@69 631 * @stable ICU 2.2
jpayne@69 632 */
jpayne@69 633 virtual UClassID getDynamicClassID() const;
jpayne@69 634
jpayne@69 635 /**
jpayne@69 636 * ICU "poor man's RTTI", returns a UClassID for this class.
jpayne@69 637 *
jpayne@69 638 * @stable ICU 2.2
jpayne@69 639 */
jpayne@69 640 static UClassID U_EXPORT2 getStaticClassID();
jpayne@69 641
jpayne@69 642 private:
jpayne@69 643
jpayne@69 644 friend class SimpleDateFormat;
jpayne@69 645 friend class DateFormatSymbolsSingleSetter; // see udat.cpp
jpayne@69 646
jpayne@69 647 /**
jpayne@69 648 * Abbreviated era strings. For example: "AD" and "BC".
jpayne@69 649 */
jpayne@69 650 UnicodeString* fEras;
jpayne@69 651 int32_t fErasCount;
jpayne@69 652
jpayne@69 653 /**
jpayne@69 654 * Era name strings. For example: "Anno Domini" and "Before Christ".
jpayne@69 655 */
jpayne@69 656 UnicodeString* fEraNames;
jpayne@69 657 int32_t fEraNamesCount;
jpayne@69 658
jpayne@69 659 /**
jpayne@69 660 * Narrow era strings. For example: "A" and "B".
jpayne@69 661 */
jpayne@69 662 UnicodeString* fNarrowEras;
jpayne@69 663 int32_t fNarrowErasCount;
jpayne@69 664
jpayne@69 665 /**
jpayne@69 666 * Month strings. For example: "January", "February", etc.
jpayne@69 667 */
jpayne@69 668 UnicodeString* fMonths;
jpayne@69 669 int32_t fMonthsCount;
jpayne@69 670
jpayne@69 671 /**
jpayne@69 672 * Short month strings. For example: "Jan", "Feb", etc.
jpayne@69 673 */
jpayne@69 674 UnicodeString* fShortMonths;
jpayne@69 675 int32_t fShortMonthsCount;
jpayne@69 676
jpayne@69 677 /**
jpayne@69 678 * Narrow month strings. For example: "J", "F", etc.
jpayne@69 679 */
jpayne@69 680 UnicodeString* fNarrowMonths;
jpayne@69 681 int32_t fNarrowMonthsCount;
jpayne@69 682
jpayne@69 683 /**
jpayne@69 684 * Standalone Month strings. For example: "January", "February", etc.
jpayne@69 685 */
jpayne@69 686 UnicodeString* fStandaloneMonths;
jpayne@69 687 int32_t fStandaloneMonthsCount;
jpayne@69 688
jpayne@69 689 /**
jpayne@69 690 * Standalone Short month strings. For example: "Jan", "Feb", etc.
jpayne@69 691 */
jpayne@69 692 UnicodeString* fStandaloneShortMonths;
jpayne@69 693 int32_t fStandaloneShortMonthsCount;
jpayne@69 694
jpayne@69 695 /**
jpayne@69 696 * Standalone Narrow month strings. For example: "J", "F", etc.
jpayne@69 697 */
jpayne@69 698 UnicodeString* fStandaloneNarrowMonths;
jpayne@69 699 int32_t fStandaloneNarrowMonthsCount;
jpayne@69 700
jpayne@69 701 /**
jpayne@69 702 * CLDR-style format wide weekday strings. For example: "Sunday", "Monday", etc.
jpayne@69 703 */
jpayne@69 704 UnicodeString* fWeekdays;
jpayne@69 705 int32_t fWeekdaysCount;
jpayne@69 706
jpayne@69 707 /**
jpayne@69 708 * CLDR-style format abbreviated (not short) weekday strings. For example: "Sun", "Mon", etc.
jpayne@69 709 */
jpayne@69 710 UnicodeString* fShortWeekdays;
jpayne@69 711 int32_t fShortWeekdaysCount;
jpayne@69 712
jpayne@69 713 /**
jpayne@69 714 * CLDR-style format short weekday strings. For example: "Su", "Mo", etc.
jpayne@69 715 */
jpayne@69 716 UnicodeString* fShorterWeekdays;
jpayne@69 717 int32_t fShorterWeekdaysCount;
jpayne@69 718
jpayne@69 719 /**
jpayne@69 720 * CLDR-style format narrow weekday strings. For example: "S", "M", etc.
jpayne@69 721 */
jpayne@69 722 UnicodeString* fNarrowWeekdays;
jpayne@69 723 int32_t fNarrowWeekdaysCount;
jpayne@69 724
jpayne@69 725 /**
jpayne@69 726 * CLDR-style standalone wide weekday strings. For example: "Sunday", "Monday", etc.
jpayne@69 727 */
jpayne@69 728 UnicodeString* fStandaloneWeekdays;
jpayne@69 729 int32_t fStandaloneWeekdaysCount;
jpayne@69 730
jpayne@69 731 /**
jpayne@69 732 * CLDR-style standalone abbreviated (not short) weekday strings. For example: "Sun", "Mon", etc.
jpayne@69 733 */
jpayne@69 734 UnicodeString* fStandaloneShortWeekdays;
jpayne@69 735 int32_t fStandaloneShortWeekdaysCount;
jpayne@69 736
jpayne@69 737 /**
jpayne@69 738 * CLDR-style standalone short weekday strings. For example: "Su", "Mo", etc.
jpayne@69 739 */
jpayne@69 740 UnicodeString* fStandaloneShorterWeekdays;
jpayne@69 741 int32_t fStandaloneShorterWeekdaysCount;
jpayne@69 742
jpayne@69 743 /**
jpayne@69 744 * Standalone Narrow weekday strings. For example: "Sun", "Mon", etc.
jpayne@69 745 */
jpayne@69 746 UnicodeString* fStandaloneNarrowWeekdays;
jpayne@69 747 int32_t fStandaloneNarrowWeekdaysCount;
jpayne@69 748
jpayne@69 749 /**
jpayne@69 750 * Ampm strings. For example: "AM" and "PM".
jpayne@69 751 */
jpayne@69 752 UnicodeString* fAmPms;
jpayne@69 753 int32_t fAmPmsCount;
jpayne@69 754
jpayne@69 755 /**
jpayne@69 756 * Narrow Ampm strings. For example: "a" and "p".
jpayne@69 757 */
jpayne@69 758 UnicodeString* fNarrowAmPms;
jpayne@69 759 int32_t fNarrowAmPmsCount;
jpayne@69 760
jpayne@69 761 /**
jpayne@69 762 * Time separator string. For example: ":".
jpayne@69 763 */
jpayne@69 764 UnicodeString fTimeSeparator;
jpayne@69 765
jpayne@69 766 /**
jpayne@69 767 * Quarter strings. For example: "1st quarter", "2nd quarter", etc.
jpayne@69 768 */
jpayne@69 769 UnicodeString *fQuarters;
jpayne@69 770 int32_t fQuartersCount;
jpayne@69 771
jpayne@69 772 /**
jpayne@69 773 * Short quarters. For example: "Q1", "Q2", etc.
jpayne@69 774 */
jpayne@69 775 UnicodeString *fShortQuarters;
jpayne@69 776 int32_t fShortQuartersCount;
jpayne@69 777
jpayne@69 778 /**
jpayne@69 779 * Standalone quarter strings. For example: "1st quarter", "2nd quarter", etc.
jpayne@69 780 */
jpayne@69 781 UnicodeString *fStandaloneQuarters;
jpayne@69 782 int32_t fStandaloneQuartersCount;
jpayne@69 783
jpayne@69 784 /**
jpayne@69 785 * Standalone short quarter strings. For example: "Q1", "Q2", etc.
jpayne@69 786 */
jpayne@69 787 UnicodeString *fStandaloneShortQuarters;
jpayne@69 788 int32_t fStandaloneShortQuartersCount;
jpayne@69 789
jpayne@69 790 /**
jpayne@69 791 * All leap month patterns, for example "{0}bis".
jpayne@69 792 */
jpayne@69 793 UnicodeString *fLeapMonthPatterns;
jpayne@69 794 int32_t fLeapMonthPatternsCount;
jpayne@69 795
jpayne@69 796 /**
jpayne@69 797 * Cyclic year names, for example: "jia-zi", "yi-chou", ... "gui-hai";
jpayne@69 798 * currently we only have data for format/abbreviated.
jpayne@69 799 * For the others, just get from format/abbreviated, ignore set.
jpayne@69 800 */
jpayne@69 801 UnicodeString *fShortYearNames;
jpayne@69 802 int32_t fShortYearNamesCount;
jpayne@69 803
jpayne@69 804 /**
jpayne@69 805 * Cyclic zodiac names, for example "Rat", "Ox", "Tiger", etc.;
jpayne@69 806 * currently we only have data for format/abbreviated.
jpayne@69 807 * For the others, just get from format/abbreviated, ignore set.
jpayne@69 808 */
jpayne@69 809 UnicodeString *fShortZodiacNames;
jpayne@69 810 int32_t fShortZodiacNamesCount;
jpayne@69 811
jpayne@69 812 /**
jpayne@69 813 * Localized names of time zones in this locale. This is a
jpayne@69 814 * two-dimensional array of strings of size n by m,
jpayne@69 815 * where m is at least 5 and up to 7. Each of the n rows is an
jpayne@69 816 * entry containing the localized names for a single TimeZone.
jpayne@69 817 *
jpayne@69 818 * Each such row contains (with i ranging from 0..n-1):
jpayne@69 819 *
jpayne@69 820 * zoneStrings[i][0] - time zone ID
jpayne@69 821 * example: America/Los_Angeles
jpayne@69 822 * zoneStrings[i][1] - long name of zone in standard time
jpayne@69 823 * example: Pacific Standard Time
jpayne@69 824 * zoneStrings[i][2] - short name of zone in standard time
jpayne@69 825 * example: PST
jpayne@69 826 * zoneStrings[i][3] - long name of zone in daylight savings time
jpayne@69 827 * example: Pacific Daylight Time
jpayne@69 828 * zoneStrings[i][4] - short name of zone in daylight savings time
jpayne@69 829 * example: PDT
jpayne@69 830 * zoneStrings[i][5] - location name of zone
jpayne@69 831 * example: United States (Los Angeles)
jpayne@69 832 * zoneStrings[i][6] - long generic name of zone
jpayne@69 833 * example: Pacific Time
jpayne@69 834 * zoneStrings[i][7] - short generic of zone
jpayne@69 835 * example: PT
jpayne@69 836 *
jpayne@69 837 * The zone ID is not localized; it corresponds to the ID
jpayne@69 838 * value associated with a system time zone object. All other entries
jpayne@69 839 * are localized names. If a zone does not implement daylight savings
jpayne@69 840 * time, the daylight savings time names are ignored.
jpayne@69 841 *
jpayne@69 842 * Note:CLDR 1.5 introduced metazone and its historical mappings.
jpayne@69 843 * This simple two-dimensional array is no longer sufficient to represent
jpayne@69 844 * localized names and its historic changes. Since ICU 3.8.1, localized
jpayne@69 845 * zone names extracted from ICU locale data is stored in a ZoneStringFormat
jpayne@69 846 * instance. But we still need to support the old way of customizing
jpayne@69 847 * localized zone names, so we keep this field for the purpose.
jpayne@69 848 */
jpayne@69 849 UnicodeString **fZoneStrings; // Zone string array set by setZoneStrings
jpayne@69 850 UnicodeString **fLocaleZoneStrings; // Zone string array created by the locale
jpayne@69 851 int32_t fZoneStringsRowCount;
jpayne@69 852 int32_t fZoneStringsColCount;
jpayne@69 853
jpayne@69 854 Locale fZSFLocale; // Locale used for getting ZoneStringFormat
jpayne@69 855
jpayne@69 856 /**
jpayne@69 857 * Localized date-time pattern characters. For example: use 'u' as 'y'.
jpayne@69 858 */
jpayne@69 859 UnicodeString fLocalPatternChars;
jpayne@69 860
jpayne@69 861 /**
jpayne@69 862 * Capitalization transforms. For each usage type, the first array element indicates
jpayne@69 863 * whether to titlecase for uiListOrMenu context, the second indicates whether to
jpayne@69 864 * titlecase for stand-alone context.
jpayne@69 865 */
jpayne@69 866 UBool fCapitalization[kCapContextUsageTypeCount][2];
jpayne@69 867
jpayne@69 868 /**
jpayne@69 869 * Abbreviated (== short) day period strings.
jpayne@69 870 */
jpayne@69 871 UnicodeString *fAbbreviatedDayPeriods;
jpayne@69 872 int32_t fAbbreviatedDayPeriodsCount;
jpayne@69 873
jpayne@69 874 /**
jpayne@69 875 * Wide day period strings.
jpayne@69 876 */
jpayne@69 877 UnicodeString *fWideDayPeriods;
jpayne@69 878 int32_t fWideDayPeriodsCount;
jpayne@69 879
jpayne@69 880 /**
jpayne@69 881 * Narrow day period strings.
jpayne@69 882 */
jpayne@69 883 UnicodeString *fNarrowDayPeriods;
jpayne@69 884 int32_t fNarrowDayPeriodsCount;
jpayne@69 885
jpayne@69 886 /**
jpayne@69 887 * Stand-alone abbreviated (== short) day period strings.
jpayne@69 888 */
jpayne@69 889 UnicodeString *fStandaloneAbbreviatedDayPeriods;
jpayne@69 890 int32_t fStandaloneAbbreviatedDayPeriodsCount;
jpayne@69 891
jpayne@69 892 /**
jpayne@69 893 * Stand-alone wide day period strings.
jpayne@69 894 */
jpayne@69 895 UnicodeString *fStandaloneWideDayPeriods;
jpayne@69 896 int32_t fStandaloneWideDayPeriodsCount;
jpayne@69 897
jpayne@69 898 /**
jpayne@69 899 * Stand-alone narrow day period strings.
jpayne@69 900 */
jpayne@69 901 UnicodeString *fStandaloneNarrowDayPeriods;
jpayne@69 902 int32_t fStandaloneNarrowDayPeriodsCount;
jpayne@69 903
jpayne@69 904 private:
jpayne@69 905 /** valid/actual locale information
jpayne@69 906 * these are always ICU locales, so the length should not be a problem
jpayne@69 907 */
jpayne@69 908 char validLocale[ULOC_FULLNAME_CAPACITY];
jpayne@69 909 char actualLocale[ULOC_FULLNAME_CAPACITY];
jpayne@69 910
jpayne@69 911 DateFormatSymbols(); // default constructor not implemented
jpayne@69 912
jpayne@69 913 /**
jpayne@69 914 * Called by the constructors to actually load data from the resources
jpayne@69 915 *
jpayne@69 916 * @param locale The locale to get symbols for.
jpayne@69 917 * @param type Calendar Type (as from Calendar::getType())
jpayne@69 918 * @param status Input/output parameter, set to success or
jpayne@69 919 * failure code upon return.
jpayne@69 920 * @param useLastResortData determine if use last resort data
jpayne@69 921 */
jpayne@69 922 void initializeData(const Locale& locale, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
jpayne@69 923
jpayne@69 924 /**
jpayne@69 925 * Copy or alias an array in another object, as appropriate.
jpayne@69 926 *
jpayne@69 927 * @param dstArray the copy destination array.
jpayne@69 928 * @param dstCount fill in with the lenth of 'dstArray'.
jpayne@69 929 * @param srcArray the source array to be copied.
jpayne@69 930 * @param srcCount the length of items to be copied from the 'srcArray'.
jpayne@69 931 */
jpayne@69 932 static void assignArray(UnicodeString*& dstArray,
jpayne@69 933 int32_t& dstCount,
jpayne@69 934 const UnicodeString* srcArray,
jpayne@69 935 int32_t srcCount);
jpayne@69 936
jpayne@69 937 /**
jpayne@69 938 * Return true if the given arrays' contents are equal, or if the arrays are
jpayne@69 939 * identical (pointers are equal).
jpayne@69 940 *
jpayne@69 941 * @param array1 one array to be compared with.
jpayne@69 942 * @param array2 another array to be compared with.
jpayne@69 943 * @param count the length of items to be copied.
jpayne@69 944 * @return true if the given arrays' contents are equal, or if the arrays are
jpayne@69 945 * identical (pointers are equal).
jpayne@69 946 */
jpayne@69 947 static UBool arrayCompare(const UnicodeString* array1,
jpayne@69 948 const UnicodeString* array2,
jpayne@69 949 int32_t count);
jpayne@69 950
jpayne@69 951 /**
jpayne@69 952 * Create a copy, in fZoneStrings, of the given zone strings array. The
jpayne@69 953 * member variables fZoneStringsRowCount and fZoneStringsColCount should be
jpayne@69 954 * set already by the caller.
jpayne@69 955 */
jpayne@69 956 void createZoneStrings(const UnicodeString *const * otherStrings);
jpayne@69 957
jpayne@69 958 /**
jpayne@69 959 * Delete all the storage owned by this object.
jpayne@69 960 */
jpayne@69 961 void dispose(void);
jpayne@69 962
jpayne@69 963 /**
jpayne@69 964 * Copy all of the other's data to this.
jpayne@69 965 * @param other the object to be copied.
jpayne@69 966 */
jpayne@69 967 void copyData(const DateFormatSymbols& other);
jpayne@69 968
jpayne@69 969 /**
jpayne@69 970 * Create zone strings array by locale if not yet available
jpayne@69 971 */
jpayne@69 972 void initZoneStringsArray(void);
jpayne@69 973
jpayne@69 974 /**
jpayne@69 975 * Delete just the zone strings.
jpayne@69 976 */
jpayne@69 977 void disposeZoneStrings(void);
jpayne@69 978
jpayne@69 979 /**
jpayne@69 980 * Returns the date format field index of the pattern character c,
jpayne@69 981 * or UDAT_FIELD_COUNT if c is not a pattern character.
jpayne@69 982 */
jpayne@69 983 static UDateFormatField U_EXPORT2 getPatternCharIndex(char16_t c);
jpayne@69 984
jpayne@69 985 /**
jpayne@69 986 * Returns TRUE if f (with its pattern character repeated count times) is a numeric field.
jpayne@69 987 */
jpayne@69 988 static UBool U_EXPORT2 isNumericField(UDateFormatField f, int32_t count);
jpayne@69 989
jpayne@69 990 /**
jpayne@69 991 * Returns TRUE if c (repeated count times) is the pattern character for a numeric field.
jpayne@69 992 */
jpayne@69 993 static UBool U_EXPORT2 isNumericPatternChar(char16_t c, int32_t count);
jpayne@69 994 public:
jpayne@69 995 #ifndef U_HIDE_INTERNAL_API
jpayne@69 996 /**
jpayne@69 997 * Gets a DateFormatSymbols by locale.
jpayne@69 998 * Unlike the constructors which always use gregorian calendar, this
jpayne@69 999 * method uses the calendar in the locale. If the locale contains no
jpayne@69 1000 * explicit calendar, this method uses the default calendar for that
jpayne@69 1001 * locale.
jpayne@69 1002 * @param locale the locale.
jpayne@69 1003 * @param status error returned here.
jpayne@69 1004 * @return the new DateFormatSymbols which the caller owns.
jpayne@69 1005 * @internal For ICU use only.
jpayne@69 1006 */
jpayne@69 1007 static DateFormatSymbols * U_EXPORT2 createForLocale(
jpayne@69 1008 const Locale &locale, UErrorCode &status);
jpayne@69 1009 #endif /* U_HIDE_INTERNAL_API */
jpayne@69 1010 };
jpayne@69 1011
jpayne@69 1012 U_NAMESPACE_END
jpayne@69 1013
jpayne@69 1014 #endif /* #if !UCONFIG_NO_FORMATTING */
jpayne@69 1015
jpayne@69 1016 #endif /* U_SHOW_CPLUSPLUS_API */
jpayne@69 1017
jpayne@69 1018 #endif // _DTFMTSYM
jpayne@69 1019 //eof