00001 /* 00002 ******************************************************************************* 00003 * Copyright (C) 2014-2016, International Business Machines Corporation and others. 00004 * All Rights Reserved. 00005 ******************************************************************************* 00006 */ 00007 00008 #ifndef REGION_H 00009 #define REGION_H 00010 00016 #include "unicode/utypes.h" 00017 #include "unicode/uregion.h" 00018 00019 #if !UCONFIG_NO_FORMATTING 00020 00021 #include "unicode/uobject.h" 00022 #include "unicode/uniset.h" 00023 #include "unicode/unistr.h" 00024 #include "unicode/strenum.h" 00025 00026 U_NAMESPACE_BEGIN 00027 00068 class U_I18N_API Region : public UObject { 00069 public: 00074 virtual ~Region(); 00075 00080 UBool operator==(const Region &that) const; 00081 00086 UBool operator!=(const Region &that) const; 00087 00095 static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status); 00096 00102 static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status); 00103 00108 static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status); 00109 00116 const Region* getContainingRegion() const; 00117 00126 const Region* getContainingRegion(URegionType type) const; 00127 00137 StringEnumeration* getContainedRegions(UErrorCode &status) const; 00138 00146 StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const; 00147 00152 UBool contains(const Region &other) const; 00153 00160 StringEnumeration* getPreferredValues(UErrorCode &status) const; 00161 00166 const char* getRegionCode() const; 00167 00173 int32_t getNumericCode() const; 00174 00179 URegionType getType() const; 00180 00181 #ifndef U_HIDE_INTERNAL_API 00182 00186 static void cleanupRegionData(); 00187 #endif /* U_HIDE_INTERNAL_API */ 00188 00189 private: 00190 char id[4]; 00191 UnicodeString idStr; 00192 int32_t code; 00193 URegionType type; 00194 Region *containingRegion; 00195 UVector *containedRegions; 00196 UVector *preferredValues; 00197 00201 Region(); 00202 00203 00204 /* 00205 * Initializes the region data from the ICU resource bundles. The region data 00206 * contains the basic relationships such as which regions are known, what the numeric 00207 * codes are, any known aliases, and the territory containment data. 00208 * 00209 * If the region data has already loaded, then this method simply returns without doing 00210 * anything meaningful. 00211 */ 00212 00213 static void loadRegionData(UErrorCode &status); 00214 00215 }; 00216 00217 U_NAMESPACE_END 00218 00219 #endif /* #if !UCONFIG_NO_FORMATTING */ 00220 #endif // REGION_H 00221 00222 //eof
1.6.1