ICU 56.1  56.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-2015, 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 
104 #ifndef U_HIDE_DRAFT_API
105 
109  static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status);
110 #endif /* U_HIDE_DRAFT_API */
111 
118  const Region* getContainingRegion() const;
119 
128  const Region* getContainingRegion(URegionType type) const;
129 
130 #ifndef U_HIDE_DRAFT_API
131 
140  StringEnumeration* getContainedRegions(UErrorCode &status) const;
141 
149  StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const;
150 #endif /* U_HIDE_DRAFT_API */
151 
156  UBool contains(const Region &other) const;
157 
158 #ifndef U_HIDE_DRAFT_API
159 
165  StringEnumeration* getPreferredValues(UErrorCode &status) const;
166 #endif /* U_HIDE_DRAFT_API */
167 
172  const char* getRegionCode() const;
173 
179  int32_t getNumericCode() const;
180 
185  URegionType getType() const;
186 
187 #ifndef U_HIDE_INTERNAL_API
188 
192  static void cleanupRegionData();
193 #endif /* U_HIDE_INTERNAL_API */
194 
195 private:
196  char id[4];
197  UnicodeString idStr;
198  int32_t code;
199  URegionType type;
200  Region *containingRegion;
201  UVector *containedRegions;
202  UVector *preferredValues;
203 
207  Region();
208 
209 
210  /*
211  * Initializes the region data from the ICU resource bundles. The region data
212  * contains the basic relationships such as which regions are known, what the numeric
213  * codes are, any known aliases, and the territory containment data.
214  *
215  * If the region data has already loaded, then this method simply returns without doing
216  * anything meaningful.
217  */
218 
219  static void loadRegionData(UErrorCode &status);
220 
221 };
222 
224 
225 #endif /* #if !UCONFIG_NO_FORMATTING */
226 #endif // REGION_H
227 
228 //eof