ICU 63.1  63.1
region.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4  *******************************************************************************
5  * Copyright (C) 2014-2016, International Business Machines Corporation and others.
6  * All Rights Reserved.
7  *******************************************************************************
8  */
9 
10 #ifndef REGION_H
11 #define REGION_H
12 
18 #include "unicode/utypes.h"
19 #include "unicode/uregion.h"
20 
21 #if !UCONFIG_NO_FORMATTING
22 
23 #include "unicode/uobject.h"
24 #include "unicode/uniset.h"
25 #include "unicode/unistr.h"
26 #include "unicode/strenum.h"
27 
29 
70 class U_I18N_API Region : public UObject {
71 public:
76  virtual ~Region();
77 
82  UBool operator==(const Region &that) const;
83 
88  UBool operator!=(const Region &that) const;
89 
97  static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
98 
104  static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
105 
110  static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status);
111 
118  const Region* getContainingRegion() const;
119 
129 
140 
149 
154  UBool contains(const Region &other) const;
155 
163 
168  const char* getRegionCode() const;
169 
175  int32_t getNumericCode() const;
176 
182 
183 #ifndef U_HIDE_INTERNAL_API
184 
188  static void cleanupRegionData();
189 #endif /* U_HIDE_INTERNAL_API */
190 
191 private:
192  char id[4];
193  UnicodeString idStr;
194  int32_t code;
195  URegionType fType;
196  Region *containingRegion;
197  UVector *containedRegions;
198  UVector *preferredValues;
199 
203  Region();
204 
205 
206  /*
207  * Initializes the region data from the ICU resource bundles. The region data
208  * contains the basic relationships such as which regions are known, what the numeric
209  * codes are, any known aliases, and the territory containment data.
210  *
211  * If the region data has already loaded, then this method simply returns without doing
212  * anything meaningful.
213  */
214 
215  static void U_CALLCONV loadRegionData(UErrorCode &status);
216 
217 };
218 
220 
221 #endif /* #if !UCONFIG_NO_FORMATTING */
222 #endif // REGION_H
223 
224 //eof
icu::Region::~Region
virtual ~Region()
Destructor.
uregion.h
C API: URegion (territory containment and mapping)
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:225
U_CALLCONV
#define U_CALLCONV
Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary in callback function typedefs to ma...
Definition: platform.h:840
icu::Region::operator!=
UBool operator!=(const Region &that) const
Returns true if the two regions are NOT equal; that is, if operator ==() returns false.
URegionType
URegionType
URegionType is an enumeration defining the different types of regions.
Definition: uregion.h:65
icu::Region::getContainedRegions
StringEnumeration * getContainedRegions(UErrorCode &status) const
Return an enumeration over the IDs of all the regions that are immediate children of this region in t...
icu::Region::getType
URegionType getType() const
Returns the region type of this region.
icu::Region::getPreferredValues
StringEnumeration * getPreferredValues(UErrorCode &status) const
For deprecated regions, return an enumeration over the IDs of the regions that are the preferred repl...
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:290
icu::Region::getContainingRegion
const Region * getContainingRegion(URegionType type) const
Return a pointer to the region that geographically contains this region and matches the given type,...
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:220
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:401
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:57
icu::Region::getAvailable
static StringEnumeration * getAvailable(URegionType type, UErrorCode &status)
Returns an enumeration over the IDs of all known regions that match the given type.
icu::Region::contains
UBool contains(const Region &other) const
Returns true if this region contains the supplied other region anywhere in the region hierarchy.
icu::Region::getInstance
static const Region * getInstance(int32_t code, UErrorCode &status)
Returns a pointer to a Region using the given numeric region code.
icu::Region::operator==
UBool operator==(const Region &that) const
Returns true if the two regions are equal.
icu::Region
Region is the class representing a Unicode Region Code, also known as a Unicode Region Subtag,...
Definition: region.h:70
icu::Region::getNumericCode
int32_t getNumericCode() const
Return this region's numeric code.
icu::Region::cleanupRegionData
static void cleanupRegionData()
Cleans up statically allocated memory.
icu::Region::getInstance
static const Region * getInstance(const char *region_code, UErrorCode &status)
Returns a pointer to a Region using the given region code.
strenum.h
C++ API: String Enumeration.
icu::Region::getContainedRegions
StringEnumeration * getContainedRegions(URegionType type, UErrorCode &status) const
Returns an enumeration over the IDs of all the regions that are children of this region anywhere in t...
uobject.h
C++ API: Common ICU base class UObject.
uniset.h
C++ API: Unicode Set.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:138
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
unistr.h
C++ API: Unicode String.
icu::Region::getContainingRegion
const Region * getContainingRegion() const
Returns a pointer to the region that contains this region.
icu::Region::getRegionCode
const char * getRegionCode() const
Return this region's canonical region code.