]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/udat.cpp
ICU-531.30.tar.gz
[apple/icu.git] / icuSources / i18n / udat.cpp
index 1af14507de4e6b7db811a9d5615d8312730feea2..47bfe96c97d2864a5e371503ccc153f6bfdd0659 100644 (file)
@@ -1,6 +1,6 @@
 /*
 *******************************************************************************
-*   Copyright (C) 1996-2013, International Business Machines
+*   Copyright (C) 1996-2014, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *******************************************************************************
 */
@@ -67,16 +67,19 @@ static UCalendarDateFields gDateFieldMapping[] = {
     UCAL_EXTENDED_YEAR,        // UDAT_EXTENDED_YEAR_FIELD = 20
     UCAL_JULIAN_DAY,           // UDAT_JULIAN_DAY_FIELD = 21
     UCAL_MILLISECONDS_IN_DAY,  // UDAT_MILLISECONDS_IN_DAY_FIELD = 22
-    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_RFC_FIELD = 23
-    // UCAL_DST_OFFSET also
-    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_GENERIC_FIELD = 24
+    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_RFC_FIELD = 23 (also UCAL_DST_OFFSET)
+    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_GENERIC_FIELD = 24 (also UCAL_DST_OFFSET)
     UCAL_DOW_LOCAL,            // UDAT_STANDALONE_DAY_FIELD = 25
     UCAL_MONTH,                // UDAT_STANDALONE_MONTH_FIELD = 26
     UCAL_MONTH,                // UDAT_QUARTER_FIELD = 27
     UCAL_MONTH,                // UDAT_STANDALONE_QUARTER_FIELD = 28
-    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_SPECIAL_FIELD = 29
+    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_SPECIAL_FIELD = 29 (also UCAL_DST_OFFSET)
     UCAL_YEAR,                 // UDAT_YEAR_NAME_FIELD = 30
-    UCAL_FIELD_COUNT,          // UDAT_FIELD_COUNT = 31
+    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31 (also UCAL_DST_OFFSET)
+    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_ISO_FIELD = 32 (also UCAL_DST_OFFSET)
+    UCAL_ZONE_OFFSET,          // UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33 (also UCAL_DST_OFFSET)
+    UCAL_EXTENDED_YEAR,        // UDAT_RELATED_YEAR_FIELD = 34 (not an exact match)
+    UCAL_FIELD_COUNT,          // UDAT_FIELD_COUNT = 35
     // UCAL_IS_LEAP_MONTH is not the target of a mapping
 };
 
@@ -307,6 +310,26 @@ udat_setLenient(    UDateFormat*    fmt,
     ((DateFormat*)fmt)->setLenient(isLenient);
 }
 
+U_DRAFT UBool U_EXPORT2
+udat_getBooleanAttribute(const UDateFormat* fmt, 
+                         UDateFormatBooleanAttribute attr, 
+                         UErrorCode* status)
+{
+    if(U_FAILURE(*status)) return FALSE;
+    return ((DateFormat*)fmt)->getBooleanAttribute(attr, *status);
+    //return FALSE;
+}
+
+U_DRAFT void U_EXPORT2
+udat_setBooleanAttribute(UDateFormat *fmt, 
+                         UDateFormatBooleanAttribute attr, 
+                         UBool newValue, 
+                         UErrorCode* status)
+{
+    if(U_FAILURE(*status)) return;
+    ((DateFormat*)fmt)->setBooleanAttribute(attr, newValue, *status);
+}
+
 U_CAPI const UCalendar* U_EXPORT2
 udat_getCalendar(const UDateFormat* fmt)
 {
@@ -538,6 +561,11 @@ udat_getSymbols(const   UDateFormat     *fmt,
         res = syms->getQuarters(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::ABBREVIATED);
         break;
 
+    case UADAT_CYCLIC_ZODIAC_NAMES:
+        res = syms->getZodiacNames(count);
+        index = (index > 0)? (index - 1) % 12: 0;
+        break;
+
     }
 
     if(index < count) {
@@ -652,7 +680,10 @@ udat_countSymbols(    const    UDateFormat                *fmt,
         syms->getQuarters(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::ABBREVIATED);
         break;
 
-    }
+     case UADAT_CYCLIC_ZODIAC_NAMES:
+        syms->getZodiacNames(count);
+        break;
+   }
 
     return count;
 }
@@ -980,25 +1011,23 @@ udat_getLocaleByType(const UDateFormat *fmt,
     return ((Format*)fmt)->getLocaleID(type, *status);
 }
 
-
 U_CAPI void U_EXPORT2
 udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status)
 {
-    verifyIsSimpleDateFormat(fmt, status);
     if (U_FAILURE(*status)) {
         return;
     }
-    ((SimpleDateFormat*)fmt)->setContext(value, *status);
+    ((DateFormat*)fmt)->setContext(value, *status);
+    return;
 }
 
 U_CAPI UDisplayContext U_EXPORT2
-udat_getContext(UDateFormat* fmt, UDisplayContextType type, UErrorCode* status)
+udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status)
 {
-    verifyIsSimpleDateFormat(fmt, status);
     if (U_FAILURE(*status)) {
         return (UDisplayContext)0;
     }
-    return ((SimpleDateFormat*)fmt)->getContext(type, *status);
+    return ((const DateFormat*)fmt)->getContext(type, *status);
 }