]>
Commit | Line | Data |
---|---|---|
46f4442e A |
1 | /* |
2 | ******************************************************************************* | |
729e4ab9 | 3 | * Copyright (C) 2007-2010, International Business Machines Corporation and * |
46f4442e A |
4 | * others. All Rights Reserved. * |
5 | ******************************************************************************* | |
6 | */ | |
7 | #ifndef ZONEMETA_H | |
8 | #define ZONEMETA_H | |
9 | ||
10 | #include "unicode/utypes.h" | |
11 | ||
12 | #if !UCONFIG_NO_FORMATTING | |
13 | ||
14 | #include "unicode/unistr.h" | |
15 | #include "hash.h" | |
16 | ||
17 | U_NAMESPACE_BEGIN | |
18 | ||
46f4442e A |
19 | typedef struct OlsonToMetaMappingEntry { |
20 | const UChar *mzid; // const because it's a reference to a resource bundle string. | |
21 | UDate from; | |
22 | UDate to; | |
23 | } OlsonToMetaMappingEntry; | |
24 | ||
46f4442e A |
25 | class UVector; |
26 | ||
27 | class U_I18N_API ZoneMeta { | |
28 | public: | |
29 | /** | |
30 | * Return the canonical id for this system tzid, which might be the id itself. | |
31 | * If the given system tzid is not know, U_ILLEGAL_ARGUMENT_ERROR is set in the status. | |
32 | */ | |
33 | static UnicodeString& U_EXPORT2 getCanonicalSystemID(const UnicodeString &tzid, UnicodeString &systemID, UErrorCode& status); | |
34 | ||
35 | /** | |
36 | * Return the canonical country code for this tzid. If we have none, or if the time zone | |
37 | * is not associated with a country, return null. | |
38 | */ | |
39 | static UnicodeString& U_EXPORT2 getCanonicalCountry(const UnicodeString &tzid, UnicodeString &canonicalCountry); | |
40 | ||
41 | /** | |
42 | * Return the country code if this is a 'single' time zone that can fallback to just | |
43 | * the country, otherwise return empty string. (Note, one must also check the locale data | |
44 | * to see that there is a localization for the country in order to implement | |
45 | * tr#35 appendix J step 5.) | |
46 | */ | |
47 | static UnicodeString& U_EXPORT2 getSingleCountry(const UnicodeString &tzid, UnicodeString &country); | |
48 | ||
49 | /** | |
50 | * Returns a CLDR metazone ID for the given Olson tzid and time. | |
51 | */ | |
52 | static UnicodeString& U_EXPORT2 getMetazoneID(const UnicodeString &tzid, UDate date, UnicodeString &result); | |
53 | /** | |
54 | * Returns an Olson ID for the ginve metazone and region | |
55 | */ | |
56 | static UnicodeString& U_EXPORT2 getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString ®ion, UnicodeString &result); | |
57 | ||
58 | static const UVector* U_EXPORT2 getMetazoneMappings(const UnicodeString &tzid); | |
59 | ||
60 | private: | |
61 | ZoneMeta(); // Prevent construction. | |
729e4ab9 | 62 | static UVector* createMetazoneMappings(const UnicodeString &tzid); |
46f4442e A |
63 | }; |
64 | ||
65 | U_NAMESPACE_END | |
66 | ||
67 | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
68 | #endif // ZONEMETA_H |