ICU 51.2  51.2
region.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 2013, International Business Machines Corporation
4  * All Rights Reserved.
5  *******************************************************************************
6  */
7 
8 #ifndef REGION_H
9 #define REGION_H
10 
16 #include "unicode/utypes.h"
17 
18 #ifndef U_HIDE_DRAFT_API
19 
27 typedef enum URegionType {
33 
39 
45 
51 
57 
64 
71 
77 } URegionType;
78 
79 
80 
81 #if !UCONFIG_NO_FORMATTING
82 
83 #include "unicode/uobject.h"
84 #include "unicode/uniset.h"
85 #include "unicode/unistr.h"
86 #include "unicode/strenum.h"
87 
89 
130 class U_I18N_API Region : public UObject {
131 public:
136  virtual ~Region();
137 
142  UBool operator==(const Region &that) const;
143 
148  UBool operator!=(const Region &that) const;
149 
157  static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
158 
164  static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
165 
170  static StringEnumeration* U_EXPORT2 getAvailable(URegionType type);
171 
178  const Region* getContainingRegion() const;
179 
188  const Region* getContainingRegion(URegionType type) const;
189 
199  StringEnumeration* getContainedRegions() const;
200 
208  StringEnumeration* getContainedRegions( URegionType type ) const;
209 
214  UBool contains(const Region &other) const;
215 
222  StringEnumeration* getPreferredValues() const;
223 
224 
229  const char* getRegionCode() const;
230 
236  int32_t getNumericCode() const;
237 
242  URegionType getType() const;
243 
244 #ifndef U_HIDE_INTERNAL_API
245 
249  static void cleanupRegionData();
250 #endif /* U_HIDE_INTERNAL_API */
251 
252 private:
253  char id[4];
254  UnicodeString idStr;
255  int32_t code;
256  URegionType type;
257  Region *containingRegion;
258  UVector *containedRegions;
259  UVector *preferredValues;
260 
266  Region();
267 
268 
269  /*
270  * Initializes the region data from the ICU resource bundles. The region data
271  * contains the basic relationships such as which regions are known, what the numeric
272  * codes are, any known aliases, and the territory containment data.
273  *
274  * If the region data has already loaded, then this method simply returns without doing
275  * anything meaningful.
276  * @internal
277  */
278 
279  static void loadRegionData();
280 
281 };
282 
284 
285 #endif /* #if !UCONFIG_NO_FORMATTING */
286 #endif /* U_HIDE_DRAFT_API */
287 #endif // REGION_H
288 
289 //eof