annotate modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/zonemeta.h @ 11038:20a8447c71c6

8207159: Update ICU to version 62.1 Reviewed-by: mbilla, kcr, ghb
author arajkumar
date Fri, 24 Aug 2018 15:06:40 +0530
parents fee4ef5c87df
children
rev   line source
arajkumar@11038 1 // © 2016 and later: Unicode, Inc. and others.
arajkumar@11038 2 // License & terms of use: http://www.unicode.org/copyright.html
ghb@10550 3 /*
ghb@10550 4 *******************************************************************************
ghb@10550 5 * Copyright (C) 2007-2013, International Business Machines Corporation and *
ghb@10550 6 * others. All Rights Reserved. *
ghb@10550 7 *******************************************************************************
ghb@10550 8 */
ghb@10550 9 #ifndef ZONEMETA_H
ghb@10550 10 #define ZONEMETA_H
ghb@10550 11
ghb@10550 12 #include "unicode/utypes.h"
ghb@10550 13
ghb@10550 14 #if !UCONFIG_NO_FORMATTING
ghb@10550 15
ghb@10550 16 #include "unicode/unistr.h"
ghb@10550 17 #include "hash.h"
ghb@10550 18
ghb@10550 19 U_NAMESPACE_BEGIN
ghb@10550 20
ghb@10550 21 typedef struct OlsonToMetaMappingEntry {
ghb@10550 22 const UChar *mzid; // const because it's a reference to a resource bundle string.
ghb@10550 23 UDate from;
ghb@10550 24 UDate to;
ghb@10550 25 } OlsonToMetaMappingEntry;
ghb@10550 26
ghb@10550 27 class UVector;
ghb@10550 28 class TimeZone;
ghb@10550 29
ghb@10550 30 class U_I18N_API ZoneMeta {
ghb@10550 31 public:
ghb@10550 32 /**
ghb@10550 33 * Return the canonical id for this tzid defined by CLDR, which might be the id itself.
ghb@10550 34 * If the given system tzid is not known, U_ILLEGAL_ARGUMENT_ERROR is set in the status.
ghb@10550 35 *
ghb@10550 36 * Note: this internal API supports all known system IDs and "Etc/Unknown" (which is
ghb@10550 37 * NOT a system ID).
ghb@10550 38 */
ghb@10550 39 static UnicodeString& U_EXPORT2 getCanonicalCLDRID(const UnicodeString &tzid, UnicodeString &systemID, UErrorCode& status);
ghb@10550 40
ghb@10550 41 /**
ghb@10550 42 * Return the canonical id for this tzid defined by CLDR, which might be the id itself.
ghb@10550 43 * This overload method returns a persistent const UChar*, which is guranteed to persist
arajkumar@11038 44 * (a pointer to a resource). If the given system tzid is not known, U_ILLEGAL_ARGUMENT_ERROR
arajkumar@11038 45 * is set in the status.
arajkumar@11038 46 * @param tzid Zone ID
arajkumar@11038 47 * @param status Receives the status
arajkumar@11038 48 * @return The canonical ID for the input time zone ID
ghb@10550 49 */
ghb@10550 50 static const UChar* U_EXPORT2 getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status);
ghb@10550 51
ghb@10550 52 /*
ghb@10550 53 * Conveninent method returning CLDR canonical ID for the given time zone
ghb@10550 54 */
ghb@10550 55 static const UChar* U_EXPORT2 getCanonicalCLDRID(const TimeZone& tz);
ghb@10550 56
ghb@10550 57 /**
ghb@10550 58 * Return the canonical country code for this tzid. If we have none, or if the time zone
ghb@10550 59 * is not associated with a country, return bogus string.
ghb@10550 60 * @param tzid Zone ID
ghb@10550 61 * @param country [output] Country code
ghb@10550 62 * @param isPrimary [output] TRUE if the zone is the primary zone for the country
ghb@10550 63 * @return A reference to the result country
ghb@10550 64 */
ghb@10550 65 static UnicodeString& U_EXPORT2 getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country, UBool *isPrimary = NULL);
ghb@10550 66
ghb@10550 67 /**
ghb@10550 68 * Returns a CLDR metazone ID for the given Olson tzid and time.
ghb@10550 69 */
ghb@10550 70 static UnicodeString& U_EXPORT2 getMetazoneID(const UnicodeString &tzid, UDate date, UnicodeString &result);
ghb@10550 71 /**
ghb@10550 72 * Returns an Olson ID for the ginve metazone and region
ghb@10550 73 */
ghb@10550 74 static UnicodeString& U_EXPORT2 getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &region, UnicodeString &result);
ghb@10550 75
ghb@10550 76 static const UVector* U_EXPORT2 getMetazoneMappings(const UnicodeString &tzid);
ghb@10550 77
ghb@10550 78 static const UVector* U_EXPORT2 getAvailableMetazoneIDs();
ghb@10550 79
ghb@10550 80 /**
ghb@10550 81 * Returns the pointer to the persistent time zone ID string, or NULL if the given tzid is not in the
ghb@10550 82 * tz database. This method is useful when you maintain persistent zone IDs without duplication.
ghb@10550 83 */
ghb@10550 84 static const UChar* U_EXPORT2 findTimeZoneID(const UnicodeString& tzid);
ghb@10550 85
ghb@10550 86 /**
ghb@10550 87 * Returns the pointer to the persistent meta zone ID string, or NULL if the given mzid is not available.
ghb@10550 88 * This method is useful when you maintain persistent meta zone IDs without duplication.
ghb@10550 89 */
ghb@10550 90 static const UChar* U_EXPORT2 findMetaZoneID(const UnicodeString& mzid);
ghb@10550 91
ghb@10550 92 /**
ghb@10550 93 * Creates a custom zone for the offset
ghb@10550 94 * @param offset GMT offset in milliseconds
ghb@10550 95 * @return A custom TimeZone for the offset with normalized time zone id
ghb@10550 96 */
ghb@10550 97 static TimeZone* createCustomTimeZone(int32_t offset);
ghb@10550 98
ghb@10550 99 /**
ghb@10550 100 * Returns the time zone's short ID (null terminated) for the zone.
ghb@10550 101 * For example, "uslax" for zone "America/Los_Angeles".
ghb@10550 102 * @param tz the time zone
ghb@10550 103 * @return the short ID of the time zone, or null if the short ID is not available.
ghb@10550 104 */
ghb@10550 105 static const UChar* U_EXPORT2 getShortID(const TimeZone& tz);
ghb@10550 106
ghb@10550 107 /**
ghb@10550 108 * Returns the time zone's short ID (null terminated) for the zone ID.
ghb@10550 109 * For example, "uslax" for zone ID "America/Los_Angeles".
ghb@10550 110 * @param tz the time zone ID
ghb@10550 111 * @return the short ID of the time zone ID, or null if the short ID is not available.
ghb@10550 112 */
ghb@10550 113 static const UChar* U_EXPORT2 getShortID(const UnicodeString& id);
ghb@10550 114
ghb@10550 115 private:
ghb@10550 116 ZoneMeta(); // Prevent construction.
ghb@10550 117 static UVector* createMetazoneMappings(const UnicodeString &tzid);
ghb@10550 118 static UnicodeString& formatCustomID(uint8_t hour, uint8_t min, uint8_t sec, UBool negative, UnicodeString& id);
ghb@10550 119 static const UChar* getShortIDFromCanonical(const UChar* canonicalID);
ghb@10550 120 };
ghb@10550 121
ghb@10550 122 U_NAMESPACE_END
ghb@10550 123
ghb@10550 124 #endif /* #if !UCONFIG_NO_FORMATTING */
ghb@10550 125 #endif // ZONEMETA_H