OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 2014, International Business Machines Corporation and others. | 3 * Copyright (C) 2014-2015, International Business Machines Corporation and othe
rs. |
4 * All Rights Reserved. | 4 * All Rights Reserved. |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 */ | 6 */ |
7 | 7 |
8 #ifndef REGION_H | 8 #ifndef REGION_H |
9 #define REGION_H | 9 #define REGION_H |
10 | 10 |
11 /** | 11 /** |
12 * \file | 12 * \file |
13 * \brief C++ API: Region classes (territory containment) | 13 * \brief C++ API: Region classes (territory containment) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 /** | 97 /** |
98 * Returns a pointer to a Region using the given numeric region code. If the
numeric region code is not recognized, | 98 * Returns a pointer to a Region using the given numeric region code. If the
numeric region code is not recognized, |
99 * the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ). | 99 * the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ). |
100 * @stable ICU 51 | 100 * @stable ICU 51 |
101 */ | 101 */ |
102 static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status
); | 102 static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status
); |
103 | 103 |
104 #ifndef U_HIDE_DRAFT_API | 104 #ifndef U_HIDE_DRAFT_API |
105 /** | 105 /** |
106 * Returns an enumeration over the IDs of all known regions that match the g
iven type. | 106 * Returns an enumeration over the IDs of all known regions that match the g
iven type. |
107 * @draft ICU 51 | 107 * @draft ICU 55 |
108 */ | 108 */ |
109 static StringEnumeration* U_EXPORT2 getAvailable(URegionType type); | 109 static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCod
e &status); |
110 #endif /* U_HIDE_DRAFT_API */ | 110 #endif /* U_HIDE_DRAFT_API */ |
111 | 111 |
112 /** | 112 /** |
113 * Returns a pointer to the region that contains this region. Returns NULL
if this region is code "001" (World) | 113 * Returns a pointer to the region that contains this region. Returns NULL
if this region is code "001" (World) |
114 * or "ZZ" (Unknown region). For example, calling this method with region "I
T" (Italy) returns the | 114 * or "ZZ" (Unknown region). For example, calling this method with region "I
T" (Italy) returns the |
115 * region "039" (Southern Europe). | 115 * region "039" (Southern Europe). |
116 * @stable ICU 51 | 116 * @stable ICU 51 |
117 */ | 117 */ |
118 const Region* getContainingRegion() const; | 118 const Region* getContainingRegion() const; |
119 | 119 |
120 /** | 120 /** |
121 * Return a pointer to the region that geographically contains this region a
nd matches the given type, | 121 * Return a pointer to the region that geographically contains this region a
nd matches the given type, |
122 * moving multiple steps up the containment chain if necessary. Returns NUL
L if no containing region can be found | 122 * moving multiple steps up the containment chain if necessary. Returns NUL
L if no containing region can be found |
123 * that matches the given type. Note: The URegionTypes = "URGN_GROUPING", "U
RGN_DEPRECATED", or "URGN_UNKNOWN" | 123 * that matches the given type. Note: The URegionTypes = "URGN_GROUPING", "U
RGN_DEPRECATED", or "URGN_UNKNOWN" |
124 * are not appropriate for use in this API. NULL will be returned in this ca
se. For example, calling this method | 124 * are not appropriate for use in this API. NULL will be returned in this ca
se. For example, calling this method |
125 * with region "IT" (Italy) for type "URGN_CONTINENT" returns the region "15
0" ( Europe ). | 125 * with region "IT" (Italy) for type "URGN_CONTINENT" returns the region "15
0" ( Europe ). |
126 * @stable ICU 51 | 126 * @stable ICU 51 |
127 */ | 127 */ |
128 const Region* getContainingRegion(URegionType type) const; | 128 const Region* getContainingRegion(URegionType type) const; |
129 | 129 |
130 #ifndef U_HIDE_DRAFT_API | 130 #ifndef U_HIDE_DRAFT_API |
131 /** | 131 /** |
132 * Return an enumeration over the IDs of all the regions that are immediate
children of this region in the | 132 * Return an enumeration over the IDs of all the regions that are immediate
children of this region in the |
133 * region hierarchy. These returned regions could be either macro regions, t
erritories, or a mixture of the two, | 133 * region hierarchy. These returned regions could be either macro regions, t
erritories, or a mixture of the two, |
134 * depending on the containment data as defined in CLDR. This API may retur
n NULL if this region doesn't have | 134 * depending on the containment data as defined in CLDR. This API may retur
n NULL if this region doesn't have |
135 * any sub-regions. For example, calling this method with region "150" (Euro
pe) returns an enumeration containing | 135 * any sub-regions. For example, calling this method with region "150" (Euro
pe) returns an enumeration containing |
136 * the various sub regions of Europe - "039" (Southern Europe) - "151" (East
ern Europe) - "154" (Northern Europe) | 136 * the various sub regions of Europe - "039" (Southern Europe) - "151" (East
ern Europe) - "154" (Northern Europe) |
137 * and "155" (Western Europe). | 137 * and "155" (Western Europe). |
138 * @draft ICU 51 | 138 * @draft ICU 55 |
139 */ | 139 */ |
140 StringEnumeration* getContainedRegions() const; | 140 StringEnumeration* getContainedRegions(UErrorCode &status) const; |
141 | 141 |
142 /** | 142 /** |
143 * Returns an enumeration over the IDs of all the regions that are children
of this region anywhere in the region | 143 * Returns an enumeration over the IDs of all the regions that are children
of this region anywhere in the region |
144 * hierarchy and match the given type. This API may return an empty enumera
tion if this region doesn't have any | 144 * hierarchy and match the given type. This API may return an empty enumera
tion if this region doesn't have any |
145 * sub-regions that match the given type. For example, calling this method w
ith region "150" (Europe) and type | 145 * sub-regions that match the given type. For example, calling this method w
ith region "150" (Europe) and type |
146 * "URGN_TERRITORY" returns a set containing all the territories in Europe (
"FR" (France) - "IT" (Italy) - "DE" (Germany) etc. ) | 146 * "URGN_TERRITORY" returns a set containing all the territories in Europe (
"FR" (France) - "IT" (Italy) - "DE" (Germany) etc. ) |
147 * @draft ICU 51 | 147 * @draft ICU 55 |
148 */ | 148 */ |
149 StringEnumeration* getContainedRegions( URegionType type ) const; | 149 StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status
) const; |
150 #endif /* U_HIDE_DRAFT_API */ | 150 #endif /* U_HIDE_DRAFT_API */ |
151 | 151 |
152 /** | 152 /** |
153 * Returns true if this region contains the supplied other region anywhere i
n the region hierarchy. | 153 * Returns true if this region contains the supplied other region anywhere i
n the region hierarchy. |
154 * @stable ICU 51 | 154 * @stable ICU 51 |
155 */ | 155 */ |
156 UBool contains(const Region &other) const; | 156 UBool contains(const Region &other) const; |
157 | 157 |
158 #ifndef U_HIDE_DRAFT_API | 158 #ifndef U_HIDE_DRAFT_API |
159 /** | 159 /** |
160 * For deprecated regions, return an enumeration over the IDs of the regions
that are the preferred replacement | 160 * For deprecated regions, return an enumeration over the IDs of the regions
that are the preferred replacement |
161 * regions for this region. Returns null for a non-deprecated region. For
example, calling this method with region | 161 * regions for this region. Returns null for a non-deprecated region. For
example, calling this method with region |
162 * "SU" (Soviet Union) would return a list of the regions containing "RU" (R
ussia), "AM" (Armenia), "AZ" (Azerbaijan), etc... | 162 * "SU" (Soviet Union) would return a list of the regions containing "RU" (R
ussia), "AM" (Armenia), "AZ" (Azerbaijan), etc... |
163 * @draft ICU 51 | 163 * @draft ICU 55 |
164 */ | 164 */ |
165 StringEnumeration* getPreferredValues() const; | 165 StringEnumeration* getPreferredValues(UErrorCode &status) const; |
166 #endif /* U_HIDE_DRAFT_API */ | 166 #endif /* U_HIDE_DRAFT_API */ |
167 | 167 |
168 /** | 168 /** |
169 * Return this region's canonical region code. | 169 * Return this region's canonical region code. |
170 * @stable ICU 51 | 170 * @stable ICU 51 |
171 */ | 171 */ |
172 const char* getRegionCode() const; | 172 const char* getRegionCode() const; |
173 | 173 |
174 /** | 174 /** |
175 * Return this region's numeric code. | 175 * Return this region's numeric code. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 static void loadRegionData(UErrorCode &status); | 219 static void loadRegionData(UErrorCode &status); |
220 | 220 |
221 }; | 221 }; |
222 | 222 |
223 U_NAMESPACE_END | 223 U_NAMESPACE_END |
224 | 224 |
225 #endif /* #if !UCONFIG_NO_FORMATTING */ | 225 #endif /* #if !UCONFIG_NO_FORMATTING */ |
226 #endif // REGION_H | 226 #endif // REGION_H |
227 | 227 |
228 //eof | 228 //eof |
OLD | NEW |