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
68class U_I18N_API Region : public UObject {
69public:
74 virtual ~Region();
75
80 UBool operator==(const Region &that) const;
81
86 UBool operator!=(const Region &that) const;
87
96
103
109
117
127
138
147
152 UBool contains(const Region &other) const;
153
161
166 const char* getRegionCode() const;
167
174
180
181#ifndef U_HIDE_INTERNAL_API
186 static void cleanupRegionData();
187#endif /* U_HIDE_INTERNAL_API */
188
189private:
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
"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:68
UBool contains(const Region &other) const
Returns true if this region contains the supplied other region anywhere in the region hierarchy.
int32_t getNumericCode() const
Return this region's numeric code.
static const Region * getInstance(int32_t code, UErrorCode &status)
Returns a pointer to a Region using the given numeric region code.
URegionType getType() const
Returns the region type of this region.
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...
virtual ~Region()
Destructor.
static const Region * getInstance(const char *region_code, UErrorCode &status)
Returns a pointer to a Region using the given region code.
const Region * getContainingRegion(URegionType type) const
Return a pointer to the region that geographically contains this region and matches the given type,...
UBool 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() const
Returns a pointer to the region that contains this region.
static StringEnumeration * getAvailable(URegionType type, UErrorCode &status)
Returns an enumeration over the IDs of all known regions that match the given type.
const char * getRegionCode() const
Return this region's canonical region code.
StringEnumeration * getPreferredValues(UErrorCode &status) const
For deprecated regions, return an enumeration over the IDs of the regions that are the preferred repl...
StringEnumeration * getContainedRegions(UErrorCode &status) const
Return an enumeration over the IDs of all the regions that are immediate children of this region in t...
UBool operator==(const Region &that) const
Returns true if the two regions are equal.
Base class for 'pure' C++ implementations of uenum api.
Definition strenum.h:55
UObject is the common ICU "boilerplate" class.
Definition uobject.h:221
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:294
C++ API: String Enumeration.
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:63
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:476
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:358
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:129