ICU 52.1  52.1
region.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 2013, International Business Machines Corporation and others.
4  * All Rights Reserved.
5  *******************************************************************************
6  */
7 
8 #ifndef REGION_H
9 #define REGION_H
10 
16 #include "unicode/utypes.h"
17 #include "unicode/uregion.h"
18 
19 #if !UCONFIG_NO_FORMATTING
20 #ifndef U_HIDE_DRAFT_API
21 
22 #include "unicode/uobject.h"
23 #include "unicode/uniset.h"
24 #include "unicode/unistr.h"
25 #include "unicode/strenum.h"
26 
28 
69 class U_I18N_API Region : public UObject {
70 public:
75  virtual ~Region();
76 
81  UBool operator==(const Region &that) const;
82 
87  UBool operator!=(const Region &that) const;
88 
96  static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
97 
103  static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
104 
109  static StringEnumeration* U_EXPORT2 getAvailable(URegionType type);
110 
117  const Region* getContainingRegion() const;
118 
127  const Region* getContainingRegion(URegionType type) const;
128 
138  StringEnumeration* getContainedRegions() const;
139 
147  StringEnumeration* getContainedRegions( URegionType type ) const;
148 
153  UBool contains(const Region &other) const;
154 
161  StringEnumeration* getPreferredValues() const;
162 
163 
168  const char* getRegionCode() const;
169 
175  int32_t getNumericCode() const;
176 
181  URegionType getType() const;
182 
183 #ifndef U_HIDE_INTERNAL_API
184 
188  static void cleanupRegionData();
189 #endif /* U_HIDE_INTERNAL_API */
190 
191 private:
192  char id[4];
193  UnicodeString idStr;
194  int32_t code;
195  URegionType type;
196  Region *containingRegion;
197  UVector *containedRegions;
198  UVector *preferredValues;
199 
203  Region();
204 
205 
206  /*
207  * Initializes the region data from the ICU resource bundles. The region data
208  * contains the basic relationships such as which regions are known, what the numeric
209  * codes are, any known aliases, and the territory containment data.
210  *
211  * If the region data has already loaded, then this method simply returns without doing
212  * anything meaningful.
213  */
214 
215  static void loadRegionData();
216 
217 };
218 
220 
221 #endif /* U_HIDE_DRAFT_API */
222 #endif /* #if !UCONFIG_NO_FORMATTING */
223 #endif // REGION_H
224 
225 //eof