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