ICU 57.1  57.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
region.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 2014-2016, 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 
21 #include "unicode/uobject.h"
22 #include "unicode/uniset.h"
23 #include "unicode/unistr.h"
24 #include "unicode/strenum.h"
25 
27 
68 class U_I18N_API Region : public UObject {
69 public:
74  virtual ~Region();
75 
80  UBool operator==(const Region &that) const;
81 
86  UBool operator!=(const Region &that) const;
87 
95  static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
96 
102  static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
103 
108  static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status);
109 
116  const Region* getContainingRegion() const;
117 
126  const Region* getContainingRegion(URegionType type) const;
127 
137  StringEnumeration* getContainedRegions(UErrorCode &status) const;
138 
146  StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const;
147 
152  UBool contains(const Region &other) const;
153 
160  StringEnumeration* getPreferredValues(UErrorCode &status) const;
161 
166  const char* getRegionCode() const;
167 
173  int32_t getNumericCode() const;
174 
179  URegionType getType() const;
180 
181 #ifndef U_HIDE_INTERNAL_API
182 
186  static void cleanupRegionData();
187 #endif /* U_HIDE_INTERNAL_API */
188 
189 private:
190  char id[4];
191  UnicodeString idStr;
192  int32_t code;
193  URegionType type;
194  Region *containingRegion;
195  UVector *containedRegions;
196  UVector *preferredValues;
197 
201  Region();
202 
203 
204  /*
205  * Initializes the region data from the ICU resource bundles. The region data
206  * contains the basic relationships such as which regions are known, what the numeric
207  * codes are, any known aliases, and the territory containment data.
208  *
209  * If the region data has already loaded, then this method simply returns without doing
210  * anything meaningful.
211  */
212 
213  static void loadRegionData(UErrorCode &status);
214 
215 };
216 
218 
219 #endif /* #if !UCONFIG_NO_FORMATTING */
220 #endif // REGION_H
221 
222 //eof