]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/unicode/udat.h
ICU-62141.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / udat.h
index 0c37866d4dd767544619e4e362a54c051034ef52..9368ee78eb611062dce87b31e06d5a497fa17f12 100644 (file)
@@ -1,3 +1,5 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
  *******************************************************************************
  * Copyright (C) 1996-2016, International Business Machines
@@ -480,6 +482,27 @@ typedef enum UDateFormatStyle {
 #define UDAT_HOUR_TZ                    "jz"
 #endif  /* U_HIDE_DEPRECATED_API */
 
+#ifndef U_HIDE_INTERNAL_API
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * root/English abbreviated version (ASCII-range characters).
+ * @internal
+ */
+#define JP_ERA_2019_ROOT                "Reiwa"
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * Japanese abbreviated version (Han, or fullwidth Latin for testing).
+ * @internal
+ */
+#define JP_ERA_2019_JA                  "\\u4EE4\\u548C"
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * root and Japanese narrow version (ASCII-range characters).
+ * @internal
+ */
+#define JP_ERA_2019_NARROW              "R"
+#endif  // U_HIDE_INTERNAL_API
+
 /**
  * FieldPosition and UFieldPosition selectors for format fields
  * defined by DateFormat and UDateFormat.
@@ -761,21 +784,19 @@ typedef enum UDateFormatField {
     UDAT_RELATED_YEAR_FIELD = 34,
 #endif  /* U_HIDE_INTERNAL_API */
 
-#ifndef U_HIDE_DRAFT_API
     /**
      * FieldPosition selector for 'b' field alignment.
      * Displays midnight and noon for 12am and 12pm, respectively, if available;
      * otherwise fall back to AM / PM.
-     * @draft ICU 57
+     * @stable ICU 57
      */
     UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35,
 
     /* FieldPosition selector for 'B' field alignment.
      * Displays flexible day periods, such as "in the morning", if available.
-     * @draft ICU 57
+     * @stable ICU 57
      */
     UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36,
-#endif /* U_HIDE_DRAFT_API */
 
 #ifndef U_HIDE_INTERNAL_API
     /**
@@ -787,16 +808,15 @@ typedef enum UDateFormatField {
     UDAT_TIME_SEPARATOR_FIELD = 37,
 #endif  /* U_HIDE_INTERNAL_API */
 
-   /**
+#ifndef U_HIDE_DEPRECATED_API
+    /**
      * Number of FieldPosition and UFieldPosition selectors for
      * DateFormat and UDateFormat.
      * Valid selectors range from 0 to UDAT_FIELD_COUNT-1.
-     * This value is subject to change if new fields are defined
-     * in the future.
-     * @stable ICU 3.0
+     * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
      */
     UDAT_FIELD_COUNT = 38
-
+#endif  /* U_HIDE_DEPRECATED_API */
 } UDateFormatField;
 
 
@@ -818,7 +838,7 @@ typedef enum UDateFormatField {
  * of error (e.g., the input field is UDAT_FIELD_COUNT).
  * @stable ICU 4.4
  */
-U_STABLE UCalendarDateFields U_EXPORT2
+U_CAPI UCalendarDateFields U_EXPORT2
 udat_toCalendarDateField(UDateFormatField field);
 
 
@@ -850,7 +870,7 @@ udat_toCalendarDateField(UDateFormatField field);
  * an error occurred.
  * @stable ICU 2.0
  */
-U_STABLE UDateFormat* U_EXPORT2
+U_CAPI UDateFormat* U_EXPORT2
 udat_open(UDateFormatStyle  timeStyle,
           UDateFormatStyle  dateStyle,
           const char        *locale,
@@ -867,7 +887,7 @@ udat_open(UDateFormatStyle  timeStyle,
 * @param format The formatter to close.
 * @stable ICU 2.0
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_close(UDateFormat* format);
 
 
@@ -888,23 +908,24 @@ typedef enum UDateFormatBooleanAttribute {
      * @stable ICU 53
      */
     UDAT_PARSE_ALLOW_NUMERIC = 1,
-#ifndef U_HIDE_DRAFT_API
     /**
      * indicates tolerance of a partial literal match
      * e.g. accepting "--mon-02-march-2011" for a pattern of "'--: 'EEE-WW-MMMM-yyyy"
-     * @draft ICU 56
+     * @stable ICU 56
      */
     UDAT_PARSE_PARTIAL_LITERAL_MATCH = 2,
     /**
      * indicates tolerance of pattern mismatch between input data and specified format pattern.
      * e.g. accepting "September" for a month pattern of MMM ("Sep")
-     * @draft ICU 56
+     * @stable ICU 56
      */
     UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3,
-#endif /* U_HIDE_DRAFT_API */
+
+    /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+     * it is needed for layout of DateFormat object. */
     /**
-     * count boolean date format constants
-     * @stable ICU 53
+     * One more than the highest normal UDateFormatBooleanAttribute value.
+     * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
      */
     UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4
 } UDateFormatBooleanAttribute;
@@ -919,7 +940,7 @@ typedef enum UDateFormatBooleanAttribute {
  * @return The value of attr.
  * @stable ICU 53
  */
-U_STABLE UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
 udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status);
 
 /**
@@ -932,7 +953,7 @@ udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute att
  * @param status A pointer to an UErrorCode to receive any errors
  * @stable ICU 53
  */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status);
 
 
@@ -954,7 +975,7 @@ U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close);
 
 U_NAMESPACE_END
 
-#endif
+#endif // U_SHOW_CPLUSPLUS_API
 
 /**
  * Open a copy of a UDateFormat.
@@ -964,7 +985,7 @@ U_NAMESPACE_END
  * @return A pointer to a UDateFormat identical to fmt.
  * @stable ICU 2.0
  */
-U_STABLE UDateFormat* U_EXPORT2
+U_CAPI UDateFormat* U_EXPORT2
 udat_clone(const UDateFormat *fmt,
        UErrorCode *status);
 
@@ -986,7 +1007,7 @@ udat_clone(const UDateFormat *fmt,
 * @see UFieldPosition
 * @stable ICU 2.0
 */
-U_STABLE int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
 udat_format(    const    UDateFormat*    format,
                         UDate           dateToFormat,
                         UChar*          result,
@@ -1016,7 +1037,7 @@ udat_format(    const    UDateFormat*    format,
 * @see UFieldPosition
 * @stable ICU 55
 */
-U_STABLE int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
 udat_formatCalendar(    const UDateFormat*  format,
                         UCalendar*      calendar,
                         UChar*          result,
@@ -1051,7 +1072,7 @@ udat_formatCalendar(    const UDateFormat*  format,
 * @see UFieldPositionIterator
 * @stable ICU 55
 */
-U_STABLE int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
 udat_formatForFields(   const UDateFormat* format,
                         UDate           dateToFormat,
                         UChar*          result,
@@ -1089,7 +1110,7 @@ udat_formatForFields(   const UDateFormat* format,
 * @see UFieldPositionIterator
 * @stable ICU 55
 */
-U_STABLE int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
 udat_formatCalendarForFields( const UDateFormat* format,
                         UCalendar*      calendar,
                         UChar*          result,
@@ -1123,7 +1144,7 @@ udat_formatCalendarForFields( const UDateFormat* format,
 * @see udat_format
 * @stable ICU 2.0
 */
-U_STABLE UDate U_EXPORT2
+U_CAPI UDate U_EXPORT2
 udat_parse(const    UDateFormat*    format,
            const    UChar*          text,
                     int32_t         textLength,
@@ -1151,7 +1172,7 @@ udat_parse(const    UDateFormat*    format,
 * @see udat_format
 * @stable ICU 2.0
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_parseCalendar(const    UDateFormat*    format,
                             UCalendar*      calendar,
                    const    UChar*          text,
@@ -1168,7 +1189,7 @@ udat_parseCalendar(const    UDateFormat*    format,
 * @see udat_setLenient
 * @stable ICU 2.0
 */
-U_STABLE UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
 udat_isLenient(const UDateFormat* fmt);
 
 /**
@@ -1180,7 +1201,7 @@ udat_isLenient(const UDateFormat* fmt);
 * @see dat_isLenient
 * @stable ICU 2.0
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_setLenient(    UDateFormat*    fmt,
                     UBool          isLenient);
 
@@ -1193,7 +1214,7 @@ udat_setLenient(    UDateFormat*    fmt,
 * @see udat_setCalendar
 * @stable ICU 2.0
 */
-U_STABLE const UCalendar* U_EXPORT2
+U_CAPI const UCalendar* U_EXPORT2
 udat_getCalendar(const UDateFormat* fmt);
 
 /**
@@ -1205,7 +1226,7 @@ udat_getCalendar(const UDateFormat* fmt);
 * @see udat_setCalendar
 * @stable ICU 2.0
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_setCalendar(            UDateFormat*    fmt,
                     const   UCalendar*      calendarToSet);
 
@@ -1218,7 +1239,7 @@ udat_setCalendar(            UDateFormat*    fmt,
 * @see udat_setNumberFormat
 * @stable ICU 2.0
 */
-U_STABLE const UNumberFormat* U_EXPORT2
+U_CAPI const UNumberFormat* U_EXPORT2
 udat_getNumberFormat(const UDateFormat* fmt);
 
 /**
@@ -1230,7 +1251,7 @@ udat_getNumberFormat(const UDateFormat* fmt);
 * @see udat_setNumberFormatForField
 * @stable ICU 54
 */
-U_STABLE const UNumberFormat* U_EXPORT2
+U_CAPI const UNumberFormat* U_EXPORT2
 udat_getNumberFormatForField(const UDateFormat* fmt, UChar field);
 
 /**
@@ -1248,7 +1269,7 @@ udat_getNumberFormatForField(const UDateFormat* fmt, UChar field);
 * @see udat_getNumberFormatForField
 * @stable ICU 54
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_adoptNumberFormatForFields(  UDateFormat* fmt,
                             const UChar* fields,
                                   UNumberFormat*  numberFormatToSet,
@@ -1265,7 +1286,7 @@ udat_adoptNumberFormatForFields(  UDateFormat* fmt,
 * @see udat_setNumberFormatForField
 * @stable ICU 2.0
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_setNumberFormat(            UDateFormat*    fmt,
                         const   UNumberFormat*  numberFormatToSet);
 /**
@@ -1277,7 +1298,7 @@ udat_setNumberFormat(            UDateFormat*    fmt,
 * @see udat_getNumberFormat
 * @stable ICU 54
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_adoptNumberFormat(            UDateFormat*    fmt,
                                    UNumberFormat*  numberFormatToAdopt);
 /**
@@ -1289,7 +1310,7 @@ udat_adoptNumberFormat(            UDateFormat*    fmt,
 * @see udat_countAvailable
 * @stable ICU 2.0
 */
-U_STABLE const char* U_EXPORT2
+U_CAPI const char* U_EXPORT2
 udat_getAvailable(int32_t localeIndex);
 
 /**
@@ -1300,7 +1321,7 @@ udat_getAvailable(int32_t localeIndex);
 * @see udat_getAvailable
 * @stable ICU 2.0
 */
-U_STABLE int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
 udat_countAvailable(void);
 
 /**
@@ -1313,7 +1334,7 @@ udat_countAvailable(void);
 * @see udat_Set2DigitYearStart
 * @stable ICU 2.0
 */
-U_STABLE UDate U_EXPORT2
+U_CAPI UDate U_EXPORT2
 udat_get2DigitYearStart(    const   UDateFormat     *fmt,
                                     UErrorCode      *status);
 
@@ -1327,7 +1348,7 @@ udat_get2DigitYearStart(    const   UDateFormat     *fmt,
 * @see udat_Set2DigitYearStart
 * @stable ICU 2.0
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_set2DigitYearStart(    UDateFormat     *fmt,
                             UDate           d,
                             UErrorCode      *status);
@@ -1344,7 +1365,7 @@ udat_set2DigitYearStart(    UDateFormat     *fmt,
 * @see udat_applyPattern
 * @stable ICU 2.0
 */
-U_STABLE int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
 udat_toPattern(    const   UDateFormat     *fmt,
                         UBool          localized,
                         UChar           *result,
@@ -1361,7 +1382,7 @@ udat_toPattern(    const   UDateFormat     *fmt,
 * @see udat_toPattern
 * @stable ICU 2.0
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_applyPattern(            UDateFormat     *format,
                             UBool          localized,
                     const   UChar           *pattern,
@@ -1497,7 +1518,7 @@ typedef struct UDateFormatSymbols UDateFormatSymbols;
 * @see udat_setSymbols
 * @stable ICU 2.0
 */
-U_STABLE int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
 udat_getSymbols(const   UDateFormat             *fmt,
                         UDateFormatSymbolType   type,
                         int32_t                 symbolIndex,
@@ -1517,7 +1538,7 @@ udat_getSymbols(const   UDateFormat             *fmt,
 * @see udat_setSymbols
 * @stable ICU 2.0
 */
-U_STABLE int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
 udat_countSymbols(    const    UDateFormat                *fmt,
                             UDateFormatSymbolType    type);
 
@@ -1536,7 +1557,7 @@ udat_countSymbols(    const    UDateFormat                *fmt,
 * @see udat_countSymbols
 * @stable ICU 2.0
 */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_setSymbols(    UDateFormat             *format,
                     UDateFormatSymbolType   type,
                     int32_t                 symbolIndex,
@@ -1553,7 +1574,7 @@ udat_setSymbols(    UDateFormat             *format,
  * @return the locale name
  * @stable ICU 2.8
  */
-U_STABLE const char* U_EXPORT2
+U_CAPI const char* U_EXPORT2
 udat_getLocaleByType(const UDateFormat *fmt,
                      ULocDataLocaleType type,
                      UErrorCode* status);
@@ -1566,7 +1587,7 @@ udat_getLocaleByType(const UDateFormat *fmt,
  * @param status A pointer to an UErrorCode to receive any errors
  * @stable ICU 51
  */
-U_DRAFT void U_EXPORT2
+U_CAPI void U_EXPORT2
 udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status);
 
 /**
@@ -1578,7 +1599,7 @@ udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status);
  * @return The UDisplayContextValue for the specified type.
  * @stable ICU 53
  */
-U_STABLE UDisplayContext U_EXPORT2
+U_CAPI UDisplayContext U_EXPORT2
 udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
 
 #ifndef U_HIDE_INTERNAL_API