X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b25be06635768807f8f693286fa73bb2297bb06c..4388f060552cc537e71e957d32f35e9d75a61233:/icuSources/i18n/zonemeta.h diff --git a/icuSources/i18n/zonemeta.h b/icuSources/i18n/zonemeta.h index ead9f352..433957de 100644 --- a/icuSources/i18n/zonemeta.h +++ b/icuSources/i18n/zonemeta.h @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 2007-2010, International Business Machines Corporation and * +* Copyright (C) 2007-2012, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -23,14 +23,30 @@ typedef struct OlsonToMetaMappingEntry { } OlsonToMetaMappingEntry; class UVector; +class TimeZone; class U_I18N_API ZoneMeta { public: /** - * Return the canonical id for this system tzid, which might be the id itself. - * If the given system tzid is not know, U_ILLEGAL_ARGUMENT_ERROR is set in the status. + * Return the canonical id for this tzid defined by CLDR, which might be the id itself. + * If the given system tzid is not known, U_ILLEGAL_ARGUMENT_ERROR is set in the status. + * + * Note: this internal API supports all known system IDs and "Etc/Unknown" (which is + * NOT a system ID). */ - static UnicodeString& U_EXPORT2 getCanonicalSystemID(const UnicodeString &tzid, UnicodeString &systemID, UErrorCode& status); + static UnicodeString& U_EXPORT2 getCanonicalCLDRID(const UnicodeString &tzid, UnicodeString &systemID, UErrorCode& status); + + /** + * Return the canonical id for this tzid defined by CLDR, which might be the id itself. + * This overload method returns a persistent const UChar*, which is guranteed to persist + * (a pointer to a resource). + */ + static const UChar* U_EXPORT2 getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status); + + /* + * Conveninent method returning CLDR canonical ID for the given time zone + */ + static const UChar* U_EXPORT2 getCanonicalCLDRID(const TimeZone& tz); /** * Return the canonical country code for this tzid. If we have none, or if the time zone @@ -57,9 +73,32 @@ public: static const UVector* U_EXPORT2 getMetazoneMappings(const UnicodeString &tzid); + static const UVector* U_EXPORT2 getAvailableMetazoneIDs(); + + /** + * Returns the pointer to the persistent time zone ID string, or NULL if the given tzid is not in the + * tz database. This method is useful when you maintain persistent zone IDs without duplication. + */ + static const UChar* U_EXPORT2 findTimeZoneID(const UnicodeString& tzid); + + /** + * Returns the pointer to the persistent meta zone ID string, or NULL if the given mzid is not available. + * This method is useful when you maintain persistent meta zone IDs without duplication. + */ + static const UChar* U_EXPORT2 findMetaZoneID(const UnicodeString& mzid); + + /** + * Creates a custom zone for the offset + * @param offset GMT offset in milliseconds + * @return A custom TimeZone for the offset with normalized time zone id + */ + static TimeZone* createCustomTimeZone(int32_t offset); + private: ZoneMeta(); // Prevent construction. static UVector* createMetazoneMappings(const UnicodeString &tzid); + static void initAvailableMetaZoneIDs(); + static UnicodeString& formatCustomID(uint8_t hour, uint8_t min, uint8_t sec, UBool negative, UnicodeString& id); }; U_NAMESPACE_END