ICU 71.1 71.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
20 #if U_SHOW_CPLUSPLUS_API
21
22 #if !UCONFIG_NO_FORMATTING
23
24 #include "unicode/uregion.h"
25 #include "unicode/uobject.h"
26 #include "unicode/uniset.h"
27 #include "unicode/unistr.h"
28 #include "unicode/strenum.h"
29
30 U_NAMESPACE_BEGIN
31
72 class U_I18N_API Region : public UObject {
73 public:
78 virtual ~Region();
79
84 bool operator==(const Region &that) const;
85
90 bool operator!=(const Region &that) const;
91
99 static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
100
106 static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
107
112 static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status);
113
120 const Region* getContainingRegion() const;
121
130 const Region* getContainingRegion(URegionType type) const;
131
141 StringEnumeration* getContainedRegions(UErrorCode &status) const;
142
150 StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const;
151
156 UBool contains(const Region &other) const;
157
164 StringEnumeration* getPreferredValues(UErrorCode &status) const;
165
170 const char* getRegionCode() const;
171
177 int32_t getNumericCode() const;
178
183 URegionType getType() const;
184
185 #ifndef U_HIDE_INTERNAL_API
186
190 static void cleanupRegionData();
191 #endif /* U_HIDE_INTERNAL_API */
192
193 private:
194 char id[4];
195 UnicodeString idStr;
196 int32_t code;
197 URegionType fType;
198 Region *containingRegion;
199 UVector *containedRegions;
200 UVector *preferredValues;
201
205 Region();
206
207
208 /*
209 * Initializes the region data from the ICU resource bundles. The region data
210 * contains the basic relationships such as which regions are known, what the numeric
211 * codes are, any known aliases, and the territory containment data.
212 *
213 * If the region data has already loaded, then this method simply returns without doing
214 * anything meaningful.
215 */
216
217 static void U_CALLCONV loadRegionData(UErrorCode &status);
218
219 };
220
221 U_NAMESPACE_END
222
223 #endif /* #if !UCONFIG_NO_FORMATTING */
224
225 #endif /* U_SHOW_CPLUSPLUS_API */
226
227 #endif // REGION_H
228
229 //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:301
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
U_CALLCONV
#define U_CALLCONV
Definition: platform.h:870
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:65
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:61
icu::operator!=
bool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:335
icu::Region
Region is the class representing a Unicode Region Code, also known as a Unicode Region Subtag,...
Definition: region.h:72
strenum.h
C++ API: String Enumeration.
uobject.h
C++ API: Common ICU base class UObject.
uniset.h
C++ API: Unicode Set.
unistr.h
C++ API: Unicode String.