region.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2014-2016, International Business Machines Corporation and others.
* All Rights Reserved.
*******************************************************************************
*/
#ifndef REGION_H
#define REGION_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#include "unicode/uregion.h"
#include "unicode/uobject.h"
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/strenum.h"
U_NAMESPACE_BEGIN
class U_I18N_API Region : public UObject {
public:
virtual ~Region();
bool operator==(const Region &that) const;
bool operator!=(const Region &that) const;
static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status);
const Region* getContainingRegion() const;
const Region* getContainingRegion(URegionType type) const;
StringEnumeration* getContainedRegions(UErrorCode &status) const;
StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const;
UBool contains(const Region &other) const;
StringEnumeration* getPreferredValues(UErrorCode &status) const;
const char* getRegionCode() const;
int32_t getNumericCode() const;
URegionType getType() const;
#ifndef U_HIDE_INTERNAL_API
static void cleanupRegionData();
#endif /* U_HIDE_INTERNAL_API */
private:
char id[4];
UnicodeString idStr;
int32_t code;
URegionType fType;
Region *containingRegion;
UVector *containedRegions;
UVector *preferredValues;
Region();
/*
* Initializes the region data from the ICU resource bundles. The region data
* contains the basic relationships such as which regions are known, what the numeric
* codes are, any known aliases, and the territory containment data.
*
* If the region data has already loaded, then this method simply returns without doing
* anything meaningful.
*/
static void U_CALLCONV loadRegionData(UErrorCode &status);
};
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // REGION_H
//eof
icu::Region
Region is the class representing a Unicode Region Code, also known as a Unicode Region Subtag,...
Definition: region.h:72
icu::Region::getInstance
static const Region * getInstance(const char *region_code, UErrorCode &status)
Returns a pointer to a Region using the given region code.
icu::Region::operator==
bool operator==(const Region &that) const
Returns true if the two regions are equal.
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::Region::getRegionCode
const char * getRegionCode() const
Return this region's canonical region code.
icu::Region::operator!=
bool operator!=(const Region &that) const
Returns true if the two regions are NOT equal; that is, if operator ==() returns false.
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...
icu::Region::cleanupRegionData
static void cleanupRegionData()
Cleans up statically allocated memory.
icu::Region::~Region
virtual ~Region()
Destructor.
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::getType
URegionType getType() const
Returns the region type of this region.
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::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::getContainingRegion
const Region * getContainingRegion() const
Returns a pointer to the region that contains this region.
icu::Region::getNumericCode
int32_t getNumericCode() const
Return this region's numeric code.
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::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:61
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
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:866
strenum.h
C++ API: String Enumeration.
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
uniset.h
C++ API: Unicode Set.
unistr.h
C++ API: Unicode String.
uobject.h
C++ API: Common ICU base class UObject.
uregion.h
C API: URegion (territory containment and mapping)
URegionType
URegionType
URegionType is an enumeration defining the different types of regions.
Definition: uregion.h:65
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
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