X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/4388f060552cc537e71e957d32f35e9d75a61233..4f1e1a09ce4daed860e35d359ce2fceccb0764e8:/icuSources/i18n/zonemeta.h diff --git a/icuSources/i18n/zonemeta.h b/icuSources/i18n/zonemeta.h index 433957de..9dbcc878 100644 --- a/icuSources/i18n/zonemeta.h +++ b/icuSources/i18n/zonemeta.h @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* -* Copyright (C) 2007-2012, International Business Machines Corporation and * +* Copyright (C) 2007-2013, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -39,7 +41,11 @@ public: /** * 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). + * (a pointer to a resource). If the given system tzid is not known, U_ILLEGAL_ARGUMENT_ERROR + * is set in the status. + * @param tzid Zone ID + * @param status Receives the status + * @return The canonical ID for the input time zone ID */ static const UChar* U_EXPORT2 getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status); @@ -50,17 +56,13 @@ public: /** * Return the canonical country code for this tzid. If we have none, or if the time zone - * is not associated with a country, return null. + * is not associated with a country, return bogus string. + * @param tzid Zone ID + * @param country [output] Country code + * @param isPrimary [output] TRUE if the zone is the primary zone for the country + * @return A reference to the result country */ - static UnicodeString& U_EXPORT2 getCanonicalCountry(const UnicodeString &tzid, UnicodeString &canonicalCountry); - - /** - * Return the country code if this is a 'single' time zone that can fallback to just - * the country, otherwise return empty string. (Note, one must also check the locale data - * to see that there is a localization for the country in order to implement - * tr#35 appendix J step 5.) - */ - static UnicodeString& U_EXPORT2 getSingleCountry(const UnicodeString &tzid, UnicodeString &country); + static UnicodeString& U_EXPORT2 getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country, UBool *isPrimary = NULL); /** * Returns a CLDR metazone ID for the given Olson tzid and time. @@ -94,11 +96,27 @@ public: */ static TimeZone* createCustomTimeZone(int32_t offset); + /** + * Returns the time zone's short ID (null terminated) for the zone. + * For example, "uslax" for zone "America/Los_Angeles". + * @param tz the time zone + * @return the short ID of the time zone, or null if the short ID is not available. + */ + static const UChar* U_EXPORT2 getShortID(const TimeZone& tz); + + /** + * Returns the time zone's short ID (null terminated) for the zone ID. + * For example, "uslax" for zone ID "America/Los_Angeles". + * @param tz the time zone ID + * @return the short ID of the time zone ID, or null if the short ID is not available. + */ + static const UChar* U_EXPORT2 getShortID(const UnicodeString& id); + 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); + static const UChar* getShortIDFromCanonical(const UChar* canonicalID); }; U_NAMESPACE_END