ICU 73.2  73.2
region.h
Go to the documentation of this file.
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 
00020 #if U_SHOW_CPLUSPLUS_API
00021 
00022 #if !UCONFIG_NO_FORMATTING
00023 
00024 #include "unicode/uregion.h"
00025 #include "unicode/uobject.h"
00026 #include "unicode/uniset.h"
00027 #include "unicode/unistr.h"
00028 #include "unicode/strenum.h"
00029 
00030 U_NAMESPACE_BEGIN
00031 
00072 class U_I18N_API Region : public UObject {
00073 public:
00078     virtual ~Region();
00079 
00084     bool operator==(const Region &that) const;
00085 
00090     bool operator!=(const Region &that) const;
00091  
00099     static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
00100 
00106     static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
00107 
00112     static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status);
00113    
00120     const Region* getContainingRegion() const;
00121 
00130     const Region* getContainingRegion(URegionType type) const;
00131 
00141     StringEnumeration* getContainedRegions(UErrorCode &status) const;
00142 
00150     StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const;
00151  
00156     UBool contains(const Region &other) const;
00157 
00164     StringEnumeration* getPreferredValues(UErrorCode &status) const;
00165 
00170     const char* getRegionCode() const;
00171 
00177     int32_t getNumericCode() const;
00178 
00183     URegionType getType() const;
00184 
00185 #ifndef U_HIDE_INTERNAL_API
00186 
00190     static void cleanupRegionData();
00191 #endif  /* U_HIDE_INTERNAL_API */
00192 
00193 private:
00194     char id[4];
00195     UnicodeString idStr;
00196     int32_t code;
00197     URegionType fType;
00198     Region *containingRegion;
00199     UVector *containedRegions;
00200     UVector *preferredValues;
00201 
00205     Region();
00206 
00207 
00208     /*
00209      * Initializes the region data from the ICU resource bundles.  The region data
00210      * contains the basic relationships such as which regions are known, what the numeric
00211      * codes are, any known aliases, and the territory containment data.
00212      * 
00213      * If the region data has already loaded, then this method simply returns without doing
00214      * anything meaningful.
00215      */
00216 
00217     static void U_CALLCONV loadRegionData(UErrorCode &status);
00218 
00219 };
00220 
00221 U_NAMESPACE_END
00222 
00223 #endif /* #if !UCONFIG_NO_FORMATTING */
00224 
00225 #endif /* U_SHOW_CPLUSPLUS_API */
00226 
00227 #endif // REGION_H
00228 
00229 //eof