00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ******************************************************************************* 00005 * Copyright (C) 2014-2016, International Business Machines Corporation and others. 00006 * All Rights Reserved. 00007 ******************************************************************************* 00008 */ 00009 00010 #ifndef REGION_H 00011 #define REGION_H 00012 00018 #include "unicode/utypes.h" 00019 #include "unicode/uregion.h" 00020 00021 #if !UCONFIG_NO_FORMATTING 00022 00023 #include "unicode/uobject.h" 00024 #include "unicode/uniset.h" 00025 #include "unicode/unistr.h" 00026 #include "unicode/strenum.h" 00027 00028 U_NAMESPACE_BEGIN 00029 00070 class U_I18N_API Region : public UObject { 00071 public: 00076 virtual ~Region(); 00077 00082 UBool operator==(const Region &that) const; 00083 00088 UBool operator!=(const Region &that) const; 00089 00097 static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status); 00098 00104 static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status); 00105 00110 static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status); 00111 00118 const Region* getContainingRegion() const; 00119 00128 const Region* getContainingRegion(URegionType type) const; 00129 00139 StringEnumeration* getContainedRegions(UErrorCode &status) const; 00140 00148 StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const; 00149 00154 UBool contains(const Region &other) const; 00155 00162 StringEnumeration* getPreferredValues(UErrorCode &status) const; 00163 00168 const char* getRegionCode() const; 00169 00175 int32_t getNumericCode() const; 00176 00181 URegionType getType() const; 00182 00183 #ifndef U_HIDE_INTERNAL_API 00184 00188 static void cleanupRegionData(); 00189 #endif /* U_HIDE_INTERNAL_API */ 00190 00191 private: 00192 char id[4]; 00193 UnicodeString idStr; 00194 int32_t code; 00195 URegionType fType; 00196 Region *containingRegion; 00197 UVector *containedRegions; 00198 UVector *preferredValues; 00199 00203 Region(); 00204 00205 00206 /* 00207 * Initializes the region data from the ICU resource bundles. The region data 00208 * contains the basic relationships such as which regions are known, what the numeric 00209 * codes are, any known aliases, and the territory containment data. 00210 * 00211 * If the region data has already loaded, then this method simply returns without doing 00212 * anything meaningful. 00213 */ 00214 00215 static void U_CALLCONV loadRegionData(UErrorCode &status); 00216 00217 }; 00218 00219 U_NAMESPACE_END 00220 00221 #endif /* #if !UCONFIG_NO_FORMATTING */ 00222 #endif // REGION_H 00223 00224 //eof
1.6.1