ICU 57.1  57.1
region.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 2014-2016, 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 
108  static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status);
109 
116  const Region* getContainingRegion() const;
117 
126  const Region* getContainingRegion(URegionType type) const;
127 
137  StringEnumeration* getContainedRegions(UErrorCode &status) const;
138 
146  StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const;
147 
152  UBool contains(const Region &other) const;
153 
160  StringEnumeration* getPreferredValues(UErrorCode &status) const;
161 
166  const char* getRegionCode() const;
167 
173  int32_t getNumericCode() const;
174 
179  URegionType getType() const;
180 
181 #ifndef U_HIDE_INTERNAL_API
182 
186  static void cleanupRegionData();
187 #endif /* U_HIDE_INTERNAL_API */
188 
189 private:
190  char id[4];
191  UnicodeString idStr;
192  int32_t code;
193  URegionType type;
194  Region *containingRegion;
195  UVector *containedRegions;
196  UVector *preferredValues;
197 
201  Region();
202 
203 
204  /*
205  * Initializes the region data from the ICU resource bundles. The region data
206  * contains the basic relationships such as which regions are known, what the numeric
207  * codes are, any known aliases, and the territory containment data.
208  *
209  * If the region data has already loaded, then this method simply returns without doing
210  * anything meaningful.
211  */
212 
213  static void loadRegionData(UErrorCode &status);
214 
215 };
216 
218 
219 #endif /* #if !UCONFIG_NO_FORMATTING */
220 #endif // REGION_H
221 
222 //eof
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
Definition: utypes.h:358
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
URegionType
URegionType
URegionType is an enumeration defining the different types of regions.
Definition: uregion.h:63
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:293
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:55
icu::operator!=
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:218
icu::Region
Region is the class representing a Unicode Region Code, also known as a Unicode Region Subtag,...
Definition: region.h:68
strenum.h
C++ API: String Enumeration.
uobject.h
C++ API: Common ICU base class UObject.
uniset.h
C++ API: Unicode Set.
U_NAMESPACE_END
#define U_NAMESPACE_END
Definition: uversion.h:130
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
Definition: uversion.h:129
unistr.h
C++ API: Unicode String.