ICU 76.1 76.1
Loading...
Searching...
No Matches
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
30U_NAMESPACE_BEGIN
31
72class U_I18N_API Region : public UObject {
73public:
78 virtual ~Region();
79
84 bool operator==(const Region &that) const;
85
90 bool operator!=(const Region &that) const;
91
100
107
113
121
131
142
151
156 UBool contains(const Region &other) const;
157
165
170 const char* getRegionCode() const;
171
178
184
185#ifndef U_HIDE_INTERNAL_API
190 static void cleanupRegionData();
191#endif /* U_HIDE_INTERNAL_API */
192
193private:
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
222
223#endif /* #if !UCONFIG_NO_FORMATTING */
224
225#endif /* U_SHOW_CPLUSPLUS_API */
226
227#endif // REGION_H
228
229//eof
"Smart pointer" base class; do not use directly: use LocalPointer etc.
Region is the class representing a Unicode Region Code, also known as a Unicode Region Subtag,...
Definition region.h:72
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...
static const Region * getInstance(int32_t code, UErrorCode &status)
Returns a pointer to a Region using the given numeric region code.
const Region * getContainingRegion() const
Returns a pointer to the region that contains this region.
bool operator==(const Region &that) const
Returns true if the two regions are equal.
static const Region * getInstance(const char *region_code, UErrorCode &status)
Returns a pointer to a Region using the given region code.
bool operator!=(const Region &that) const
Returns true if the two regions are NOT equal; that is, if operator ==() returns false.
static void cleanupRegionData()
Cleans up statically allocated memory.
const Region * getContainingRegion(URegionType type) const
Return a pointer to the region that geographically contains this region and matches the given type,...
StringEnumeration * getContainedRegions(UErrorCode &status) const
Return an enumeration over the IDs of all the regions that are immediate children of this region in t...
virtual ~Region()
Destructor.
URegionType getType() const
Returns the region type of this region.
const char * getRegionCode() const
Return this region's canonical region code.
UBool contains(const Region &other) const
Returns true if this region contains the supplied other region anywhere in the region hierarchy.
StringEnumeration * getPreferredValues(UErrorCode &status) const
For deprecated regions, return an enumeration over the IDs of the regions that are the preferred repl...
static StringEnumeration * getAvailable(URegionType type, UErrorCode &status)
Returns an enumeration over the IDs of all known regions that match the given type.
int32_t getNumericCode() const
Return this region's numeric code.
Base class for 'pure' C++ implementations of uenum api.
Definition strenum.h:61
UObject is the common ICU "boilerplate" class.
Definition uobject.h:223
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:296
#define U_CALLCONV
Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary in callback function typedefs to ma...
Definition platform.h:846
C++ API: String Enumeration.
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition umachine.h:247
C++ API: Unicode Set.
C++ API: Unicode String.
C++ API: Common ICU base class UObject.
C API: URegion (territory containment and mapping)
URegionType
URegionType is an enumeration defining the different types of regions.
Definition uregion.h:65
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:430
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:316