ICU-9721 Fix errors found and fixed by icu-svnprops-check.py in ICU4C
X-SVN-Rev: 33326
This commit is contained in:
parent
9f684a0417
commit
e31422e17e
58
.gitattributes
vendored
58
.gitattributes
vendored
@ -52,19 +52,6 @@ icu4c/icu4c.css -text
|
||||
icu4c/source/allinone/icucheck.bat -text
|
||||
icu4c/source/common/common.vcxproj -text
|
||||
icu4c/source/common/common.vcxproj.filters -text
|
||||
icu4c/source/common/unicode/enumset.h -text
|
||||
icu4c/source/data/coll/ms_Latn.txt -text
|
||||
icu4c/source/data/coll/ms_Latn_BN.txt -text
|
||||
icu4c/source/data/coll/ms_Latn_MY.txt -text
|
||||
icu4c/source/data/coll/ms_Latn_SG.txt -text
|
||||
icu4c/source/data/curr/en_ZM.txt -text
|
||||
icu4c/source/data/curr/ms_BN.txt -text
|
||||
icu4c/source/data/curr/ms_Latn.txt -text
|
||||
icu4c/source/data/curr/ms_Latn_BN.txt -text
|
||||
icu4c/source/data/curr/ms_Latn_MY.txt -text
|
||||
icu4c/source/data/curr/ms_Latn_SG.txt -text
|
||||
icu4c/source/data/curr/ms_MY.txt -text
|
||||
icu4c/source/data/curr/ms_SG.txt -text
|
||||
icu4c/source/data/curr/pool.res -text
|
||||
icu4c/source/data/in/coll/invuca.icu -text
|
||||
icu4c/source/data/in/coll/ucadata.icu -text
|
||||
@ -77,59 +64,16 @@ icu4c/source/data/in/ucase.icu -text
|
||||
icu4c/source/data/in/unames.icu -text
|
||||
icu4c/source/data/in/uprops.icu -text
|
||||
icu4c/source/data/in/uts46.nrm -text
|
||||
icu4c/source/data/lang/ms_BN.txt -text
|
||||
icu4c/source/data/lang/ms_Latn.txt -text
|
||||
icu4c/source/data/lang/ms_Latn_BN.txt -text
|
||||
icu4c/source/data/lang/ms_Latn_MY.txt -text
|
||||
icu4c/source/data/lang/ms_Latn_SG.txt -text
|
||||
icu4c/source/data/lang/ms_MY.txt -text
|
||||
icu4c/source/data/lang/ms_SG.txt -text
|
||||
icu4c/source/data/lang/pool.res -text
|
||||
icu4c/source/data/locales/ms_BN.txt -text
|
||||
icu4c/source/data/locales/ms_Latn.txt -text
|
||||
icu4c/source/data/locales/ms_Latn_BN.txt -text
|
||||
icu4c/source/data/locales/ms_Latn_MY.txt -text
|
||||
icu4c/source/data/locales/ms_Latn_SG.txt -text
|
||||
icu4c/source/data/locales/ms_MY.txt -text
|
||||
icu4c/source/data/locales/ms_SG.txt -text
|
||||
icu4c/source/data/locales/pool.res -text
|
||||
icu4c/source/data/makedata.vcxproj -text
|
||||
icu4c/source/data/makedata.vcxproj.filters -text
|
||||
icu4c/source/data/region/ms_BN.txt -text
|
||||
icu4c/source/data/region/ms_Latn.txt -text
|
||||
icu4c/source/data/region/ms_Latn_BN.txt -text
|
||||
icu4c/source/data/region/ms_Latn_MY.txt -text
|
||||
icu4c/source/data/region/ms_Latn_SG.txt -text
|
||||
icu4c/source/data/region/ms_MY.txt -text
|
||||
icu4c/source/data/region/ms_SG.txt -text
|
||||
icu4c/source/data/region/pool.res -text
|
||||
icu4c/source/data/translit/az_Upper.txt -text
|
||||
icu4c/source/data/translit/el_Lower.txt -text
|
||||
icu4c/source/data/translit/el_Title.txt -text
|
||||
icu4c/source/data/translit/el_Upper.txt -text
|
||||
icu4c/source/data/translit/lt_Upper.txt -text
|
||||
icu4c/source/data/translit/nl_Title.txt -text
|
||||
icu4c/source/data/translit/tr_Lower.txt -text
|
||||
icu4c/source/data/translit/tr_Title.txt -text
|
||||
icu4c/source/data/translit/tr_Upper.txt -text
|
||||
icu4c/source/data/xml/main/ms_Latn.xml -text
|
||||
icu4c/source/data/zone/ms_BN.txt -text
|
||||
icu4c/source/data/zone/ms_Latn.txt -text
|
||||
icu4c/source/data/zone/ms_Latn_BN.txt -text
|
||||
icu4c/source/data/zone/ms_Latn_MY.txt -text
|
||||
icu4c/source/data/zone/ms_Latn_SG.txt -text
|
||||
icu4c/source/data/zone/ms_MY.txt -text
|
||||
icu4c/source/data/zone/ms_SG.txt -text
|
||||
icu4c/source/data/zone/pool.res -text
|
||||
icu4c/source/extra/uconv/uconv.vcxproj -text
|
||||
icu4c/source/extra/uconv/uconv.vcxproj.filters -text
|
||||
icu4c/source/i18n/dangical.cpp -text
|
||||
icu4c/source/i18n/dangical.h -text
|
||||
icu4c/source/i18n/i18n.vcxproj -text
|
||||
icu4c/source/i18n/i18n.vcxproj.filters -text
|
||||
icu4c/source/i18n/region.cpp -text
|
||||
icu4c/source/i18n/region_impl.h -text
|
||||
icu4c/source/i18n/unicode/region.h -text
|
||||
icu4c/source/io/io.vcxproj -text
|
||||
icu4c/source/io/io.vcxproj.filters -text
|
||||
icu4c/source/layout/layout.vcxproj -text
|
||||
@ -191,8 +135,6 @@ icu4c/source/test/cintltst/cintltst.vcxproj -text
|
||||
icu4c/source/test/cintltst/cintltst.vcxproj.filters -text
|
||||
icu4c/source/test/intltest/intltest.vcxproj -text
|
||||
icu4c/source/test/intltest/intltest.vcxproj.filters -text
|
||||
icu4c/source/test/intltest/regiontst.cpp -text
|
||||
icu4c/source/test/intltest/regiontst.h -text
|
||||
icu4c/source/test/iotest/iotest.vcxproj -text
|
||||
icu4c/source/test/iotest/iotest.vcxproj.filters -text
|
||||
icu4c/source/test/letest/cletest.vcxproj -text
|
||||
|
@ -1,61 +1,61 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++: internal template EnumSet<>
|
||||
*/
|
||||
|
||||
#ifndef ENUMSET_H
|
||||
#define ENUMSET_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* enum bitset for boolean fields. Similar to Java EnumSet<>.
|
||||
* Needs to range check.
|
||||
* @internal
|
||||
*/
|
||||
template<typename T, uint32_t minValue, uint32_t limitValue>
|
||||
class EnumSet {
|
||||
public:
|
||||
inline EnumSet() : fBools(0) {}
|
||||
inline EnumSet(const EnumSet<T,minValue,limitValue>& other) : fBools(other.fBools) {}
|
||||
inline ~EnumSet() {}
|
||||
inline void clear() { fBools=0; }
|
||||
inline void add(T toAdd) { set(toAdd, 1); }
|
||||
inline void remove(T toRemove) { set(toRemove, 0); }
|
||||
inline int32_t contains(T toCheck) const { return get(toCheck); }
|
||||
inline void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); }
|
||||
inline int32_t get(T toCheck) const { return (fBools & flag(toCheck))?1:0; }
|
||||
inline UBool isValidEnum(T toCheck) const { return (toCheck>=minValue&&toCheck<limitValue); }
|
||||
inline UBool isValidValue(int32_t v) const { return (v==0||v==1); }
|
||||
inline const EnumSet<T,minValue,limitValue>& operator=(const EnumSet<T,minValue,limitValue>& other) {
|
||||
fBools = other.fBools;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint32_t getAll() const {
|
||||
return fBools;
|
||||
}
|
||||
|
||||
private:
|
||||
inline uint32_t flag(T toCheck) const { return (1<<(toCheck-minValue)); }
|
||||
private:
|
||||
uint32_t fBools;
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* U_SHOW_CPLUSPLUS_API */
|
||||
#endif /* ENUMSET_H */
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++: internal template EnumSet<>
|
||||
*/
|
||||
|
||||
#ifndef ENUMSET_H
|
||||
#define ENUMSET_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* enum bitset for boolean fields. Similar to Java EnumSet<>.
|
||||
* Needs to range check.
|
||||
* @internal
|
||||
*/
|
||||
template<typename T, uint32_t minValue, uint32_t limitValue>
|
||||
class EnumSet {
|
||||
public:
|
||||
inline EnumSet() : fBools(0) {}
|
||||
inline EnumSet(const EnumSet<T,minValue,limitValue>& other) : fBools(other.fBools) {}
|
||||
inline ~EnumSet() {}
|
||||
inline void clear() { fBools=0; }
|
||||
inline void add(T toAdd) { set(toAdd, 1); }
|
||||
inline void remove(T toRemove) { set(toRemove, 0); }
|
||||
inline int32_t contains(T toCheck) const { return get(toCheck); }
|
||||
inline void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); }
|
||||
inline int32_t get(T toCheck) const { return (fBools & flag(toCheck))?1:0; }
|
||||
inline UBool isValidEnum(T toCheck) const { return (toCheck>=minValue&&toCheck<limitValue); }
|
||||
inline UBool isValidValue(int32_t v) const { return (v==0||v==1); }
|
||||
inline const EnumSet<T,minValue,limitValue>& operator=(const EnumSet<T,minValue,limitValue>& other) {
|
||||
fBools = other.fBools;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint32_t getAll() const {
|
||||
return fBools;
|
||||
}
|
||||
|
||||
private:
|
||||
inline uint32_t flag(T toCheck) const { return (1<<(toCheck-minValue)); }
|
||||
private:
|
||||
uint32_t fBools;
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* U_SHOW_CPLUSPLUS_API */
|
||||
#endif /* ENUMSET_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,43 +1,43 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2013, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
* File REGION_IMPL.H
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __REGION_IMPL_H__
|
||||
#define __REGION_IMPL_H__
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
|
||||
#include "uvector.h"
|
||||
#include "unicode/strenum.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class RegionNameEnumeration : public StringEnumeration {
|
||||
public:
|
||||
RegionNameEnumeration(UVector *fNameList, UErrorCode& status);
|
||||
virtual ~RegionNameEnumeration();
|
||||
static UClassID U_EXPORT2 getStaticClassID(void);
|
||||
virtual UClassID getDynamicClassID(void) const;
|
||||
virtual const UnicodeString* snext(UErrorCode& status);
|
||||
virtual void reset(UErrorCode& status);
|
||||
virtual int32_t count(UErrorCode& status) const;
|
||||
private:
|
||||
int32_t pos;
|
||||
UVector *fRegionNames;
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2013, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
* File REGION_IMPL.H
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __REGION_IMPL_H__
|
||||
#define __REGION_IMPL_H__
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
|
||||
#include "uvector.h"
|
||||
#include "unicode/strenum.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class RegionNameEnumeration : public StringEnumeration {
|
||||
public:
|
||||
RegionNameEnumeration(UVector *fNameList, UErrorCode& status);
|
||||
virtual ~RegionNameEnumeration();
|
||||
static UClassID U_EXPORT2 getStaticClassID(void);
|
||||
virtual UClassID getDynamicClassID(void) const;
|
||||
virtual const UnicodeString* snext(UErrorCode& status);
|
||||
virtual void reset(UErrorCode& status);
|
||||
virtual int32_t count(UErrorCode& status) const;
|
||||
private:
|
||||
int32_t pos;
|
||||
UVector *fRegionNames;
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,312 +1,312 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2013, International Business Machines Corporation *
|
||||
* All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef REGION_H
|
||||
#define REGION_H
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: Region classes (territory containment)
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* URegionType is an enumeration defining the different types of regions. Current possible
|
||||
* values are URGN_WORLD, URGN_CONTINENT, URGN_SUBCONTINENT, URGN_TERRITORY, URGN_GROUPING,
|
||||
* URGN_DEPRECATED, and URGN_UNKNOWN.
|
||||
*
|
||||
* @draft ICU 51
|
||||
*/
|
||||
|
||||
typedef enum URegionType {
|
||||
/**
|
||||
* Type representing the unknown region.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_UNKNOWN,
|
||||
|
||||
/**
|
||||
* Type representing a territory.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_TERRITORY,
|
||||
|
||||
/**
|
||||
* Type representing the whole world.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_WORLD,
|
||||
|
||||
/**
|
||||
* Type representing a continent.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_CONTINENT,
|
||||
|
||||
/**
|
||||
* Type representing a sub-continent.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_SUBCONTINENT,
|
||||
|
||||
/**
|
||||
* Type representing a grouping of territories that is not to be used in
|
||||
* the normal WORLD/CONTINENT/SUBCONTINENT/TERRITORY containment tree.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_GROUPING,
|
||||
|
||||
/**
|
||||
* Type representing a region whose code has been deprecated, usually
|
||||
* due to a country splitting into multiple territories or changing its name.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_DEPRECATED,
|
||||
|
||||
/**
|
||||
* Maximum value for this unumeration.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_LIMIT
|
||||
} URegionType;
|
||||
|
||||
|
||||
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
|
||||
#include "unicode/uobject.h"
|
||||
#include "unicode/uniset.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/strenum.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* <code>Region</code> is the class representing a Unicode Region Code, also known as a
|
||||
* Unicode Region Subtag, which is defined based upon the BCP 47 standard. We often think of
|
||||
* "regions" as "countries" when defining the characteristics of a locale. Region codes There are different
|
||||
* types of region codes that are important to distinguish.
|
||||
* <p>
|
||||
* Macroregion - A code for a "macro geographical (continental) region, geographical sub-region, or
|
||||
* selected economic and other grouping" as defined in
|
||||
* UN M.49 (http://unstats.un.org/unsd/methods/m49/m49regin.htm).
|
||||
* These are typically 3-digit codes, but contain some 2-letter codes, such as the LDML code QO
|
||||
* added for Outlying Oceania. Not all UNM.49 codes are defined in LDML, but most of them are.
|
||||
* Macroregions are represented in ICU by one of three region types: WORLD ( region code 001 ),
|
||||
* CONTINENTS ( regions contained directly by WORLD ), and SUBCONTINENTS ( things contained directly
|
||||
* by a continent ).
|
||||
* <p>
|
||||
* TERRITORY - A Region that is not a Macroregion. These are typically codes for countries, but also
|
||||
* include areas that are not separate countries, such as the code "AQ" for Antarctica or the code
|
||||
* "HK" for Hong Kong (SAR China). Overseas dependencies of countries may or may not have separate
|
||||
* codes. The codes are typically 2-letter codes aligned with the ISO 3166 standard, but BCP47 allows
|
||||
* for the use of 3-digit codes in the future.
|
||||
* <p>
|
||||
* UNKNOWN - The code ZZ is defined by Unicode LDML for use to indicate that the Region is unknown,
|
||||
* or that the value supplied as a region was invalid.
|
||||
* <p>
|
||||
* DEPRECATED - Region codes that have been defined in the past but are no longer in modern usage,
|
||||
* usually due to a country splitting into multiple territories or changing its name.
|
||||
* <p>
|
||||
* GROUPING - A widely understood grouping of territories that has a well defined membership such
|
||||
* that a region code has been assigned for it. Some of these are UNM.49 codes that do't fall into
|
||||
* the world/continent/sub-continent hierarchy, while others are just well known groupings that have
|
||||
* their own region code. Region "EU" (European Union) is one such region code that is a grouping.
|
||||
* Groupings will never be returned by the getContainingRegion() API, since a different type of region
|
||||
* ( WORLD, CONTINENT, or SUBCONTINENT ) will always be the containing region instead.
|
||||
*
|
||||
* @author John Emmons
|
||||
* @draft ICU 51
|
||||
*/
|
||||
|
||||
class U_I18N_API Region : public UObject {
|
||||
|
||||
public:
|
||||
|
||||
static const int32_t UNDEFINED_NUMERIC_CODE = -1;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the two regions are equal.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
UBool operator==(const Region &that) const;
|
||||
|
||||
/**
|
||||
* Returns true if the two regions are NOT equal; that is, if operator ==() returns false.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
UBool operator!=(const Region &that) const;
|
||||
|
||||
/**
|
||||
* Returns a pointer to a Region using the given region code. The region code can be either 2-letter ISO code,
|
||||
* 3-letter ISO code, UNM.49 numeric code, or other valid Unicode Region Code as defined by the LDML specification.
|
||||
* The identifier will be canonicalized internally using the supplemental metadata as defined in the CLDR.
|
||||
* If the region code is NULL or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR )
|
||||
* @draft ICU 51
|
||||
*/
|
||||
static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
|
||||
|
||||
/**
|
||||
* Returns a pointer to a Region using the given numeric region code. If the numeric region code is not recognized,
|
||||
* the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ).
|
||||
* @draft ICU 51
|
||||
*/
|
||||
static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
|
||||
|
||||
/**
|
||||
* Returns an enumeration over the IDs of all known regions that match the given type.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
static StringEnumeration* U_EXPORT2 getAvailable(URegionType type);
|
||||
|
||||
/**
|
||||
* Returns a pointer to the region that contains this region. Returns NULL if this region is code "001" (World)
|
||||
* or "ZZ" (Unknown region). For example, calling this method with region "IT" (Italy) returns the
|
||||
* region "039" (Southern Europe).
|
||||
* @draft ICU 51
|
||||
*/
|
||||
const Region* getContainingRegion() const;
|
||||
|
||||
/**
|
||||
* Return a pointer to the region that geographically contains this region and matches the given type,
|
||||
* moving multiple steps up the containment chain if necessary. Returns NULL if no containing region can be found
|
||||
* that matches the given type. Note: The URegionTypes = "URGN_GROUPING", "URGN_DEPRECATED", or "URGN_UNKNOWN"
|
||||
* are not appropriate for use in this API. NULL will be returned in this case. For example, calling this method
|
||||
* with region "IT" (Italy) for type "URGN_CONTINENT" returns the region "150" ( Europe ).
|
||||
* @draft ICU 51
|
||||
*/
|
||||
const Region* getContainingRegion(URegionType type) const;
|
||||
|
||||
/**
|
||||
* Return an enumeration over the IDs of all the regions that are immediate children of this region in the
|
||||
* region hierarchy. These returned regions could be either macro regions, territories, or a mixture of the two,
|
||||
* depending on the containment data as defined in CLDR. This API may return NULL if this region doesn't have
|
||||
* any sub-regions. For example, calling this method with region "150" (Europe) returns an enumeration containing
|
||||
* the various sub regions of Europe - "039" (Southern Europe) - "151" (Eastern Europe) - "154" (Northern Europe)
|
||||
* and "155" (Western Europe).
|
||||
* @draft ICU 51
|
||||
*/
|
||||
StringEnumeration* getContainedRegions() const;
|
||||
|
||||
/**
|
||||
* Returns an enumeration over the IDs of all the regions that are children of this region anywhere in the region
|
||||
* hierarchy and match the given type. This API may return an empty enumeration if this region doesn't have any
|
||||
* sub-regions that match the given type. For example, calling this method with region "150" (Europe) and type
|
||||
* "URGN_TERRITORY" returns a set containing all the territories in Europe ( "FR" (France) - "IT" (Italy) - "DE" (Germany) etc. )
|
||||
* @draft ICU 51
|
||||
*/
|
||||
StringEnumeration* getContainedRegions( URegionType type ) const;
|
||||
|
||||
/**
|
||||
* Returns true if this region contains the supplied other region anywhere in the region hierarchy.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
UBool contains(const Region &other) const;
|
||||
|
||||
/**
|
||||
* For deprecated regions, return an enumeration over the IDs of the regions that are the preferred replacement
|
||||
* regions for this region. Returns null for a non-deprecated region. For example, calling this method with region
|
||||
* "SU" (Soviet Union) would return a list of the regions containing "RU" (Russia), "AM" (Armenia), "AZ" (Azerbaijan), etc...
|
||||
* @draft ICU 51
|
||||
*/
|
||||
StringEnumeration* getPreferredValues() const;
|
||||
|
||||
|
||||
/**
|
||||
* Return this region's canonical region code.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
const char* getRegionCode() const;
|
||||
|
||||
/**
|
||||
* Return this region's numeric code. Returns UNDEFINED_NUMERIC_CODE (-1) if the given region does not have a numeric code assigned to it.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
int32_t getNumericCode() const;
|
||||
|
||||
/**
|
||||
* Returns the region type of this region.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URegionType getType() const;
|
||||
|
||||
/**
|
||||
* ICU "poor man's RTTI", returns a UClassID for this class.
|
||||
*
|
||||
* @draft ICU 51
|
||||
*
|
||||
*/
|
||||
static UClassID U_EXPORT2 getStaticClassID(void);
|
||||
|
||||
/**
|
||||
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
||||
*
|
||||
* @draft ICU 51
|
||||
*/
|
||||
virtual UClassID getDynamicClassID() const;
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Default Destructor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
~Region();
|
||||
|
||||
/**
|
||||
* Cleans up statically allocated memory.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
static void cleanupRegionData();
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
private:
|
||||
char id[4];
|
||||
UnicodeString idStr;
|
||||
int32_t code;
|
||||
URegionType type;
|
||||
Region *containingRegion;
|
||||
UVector *containedRegions;
|
||||
UVector *preferredValues;
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Default Constructor. Internal - use factory methods only.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
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.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
static void loadRegionData();
|
||||
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
#endif /* U_HIDE_DRAFT_API */
|
||||
#endif // REGION_H
|
||||
|
||||
//eof
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2013, International Business Machines Corporation *
|
||||
* All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef REGION_H
|
||||
#define REGION_H
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: Region classes (territory containment)
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* URegionType is an enumeration defining the different types of regions. Current possible
|
||||
* values are URGN_WORLD, URGN_CONTINENT, URGN_SUBCONTINENT, URGN_TERRITORY, URGN_GROUPING,
|
||||
* URGN_DEPRECATED, and URGN_UNKNOWN.
|
||||
*
|
||||
* @draft ICU 51
|
||||
*/
|
||||
|
||||
typedef enum URegionType {
|
||||
/**
|
||||
* Type representing the unknown region.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_UNKNOWN,
|
||||
|
||||
/**
|
||||
* Type representing a territory.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_TERRITORY,
|
||||
|
||||
/**
|
||||
* Type representing the whole world.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_WORLD,
|
||||
|
||||
/**
|
||||
* Type representing a continent.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_CONTINENT,
|
||||
|
||||
/**
|
||||
* Type representing a sub-continent.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_SUBCONTINENT,
|
||||
|
||||
/**
|
||||
* Type representing a grouping of territories that is not to be used in
|
||||
* the normal WORLD/CONTINENT/SUBCONTINENT/TERRITORY containment tree.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_GROUPING,
|
||||
|
||||
/**
|
||||
* Type representing a region whose code has been deprecated, usually
|
||||
* due to a country splitting into multiple territories or changing its name.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_DEPRECATED,
|
||||
|
||||
/**
|
||||
* Maximum value for this unumeration.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URGN_LIMIT
|
||||
} URegionType;
|
||||
|
||||
|
||||
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
|
||||
#include "unicode/uobject.h"
|
||||
#include "unicode/uniset.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/strenum.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* <code>Region</code> is the class representing a Unicode Region Code, also known as a
|
||||
* Unicode Region Subtag, which is defined based upon the BCP 47 standard. We often think of
|
||||
* "regions" as "countries" when defining the characteristics of a locale. Region codes There are different
|
||||
* types of region codes that are important to distinguish.
|
||||
* <p>
|
||||
* Macroregion - A code for a "macro geographical (continental) region, geographical sub-region, or
|
||||
* selected economic and other grouping" as defined in
|
||||
* UN M.49 (http://unstats.un.org/unsd/methods/m49/m49regin.htm).
|
||||
* These are typically 3-digit codes, but contain some 2-letter codes, such as the LDML code QO
|
||||
* added for Outlying Oceania. Not all UNM.49 codes are defined in LDML, but most of them are.
|
||||
* Macroregions are represented in ICU by one of three region types: WORLD ( region code 001 ),
|
||||
* CONTINENTS ( regions contained directly by WORLD ), and SUBCONTINENTS ( things contained directly
|
||||
* by a continent ).
|
||||
* <p>
|
||||
* TERRITORY - A Region that is not a Macroregion. These are typically codes for countries, but also
|
||||
* include areas that are not separate countries, such as the code "AQ" for Antarctica or the code
|
||||
* "HK" for Hong Kong (SAR China). Overseas dependencies of countries may or may not have separate
|
||||
* codes. The codes are typically 2-letter codes aligned with the ISO 3166 standard, but BCP47 allows
|
||||
* for the use of 3-digit codes in the future.
|
||||
* <p>
|
||||
* UNKNOWN - The code ZZ is defined by Unicode LDML for use to indicate that the Region is unknown,
|
||||
* or that the value supplied as a region was invalid.
|
||||
* <p>
|
||||
* DEPRECATED - Region codes that have been defined in the past but are no longer in modern usage,
|
||||
* usually due to a country splitting into multiple territories or changing its name.
|
||||
* <p>
|
||||
* GROUPING - A widely understood grouping of territories that has a well defined membership such
|
||||
* that a region code has been assigned for it. Some of these are UNM.49 codes that do't fall into
|
||||
* the world/continent/sub-continent hierarchy, while others are just well known groupings that have
|
||||
* their own region code. Region "EU" (European Union) is one such region code that is a grouping.
|
||||
* Groupings will never be returned by the getContainingRegion() API, since a different type of region
|
||||
* ( WORLD, CONTINENT, or SUBCONTINENT ) will always be the containing region instead.
|
||||
*
|
||||
* @author John Emmons
|
||||
* @draft ICU 51
|
||||
*/
|
||||
|
||||
class U_I18N_API Region : public UObject {
|
||||
|
||||
public:
|
||||
|
||||
static const int32_t UNDEFINED_NUMERIC_CODE = -1;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the two regions are equal.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
UBool operator==(const Region &that) const;
|
||||
|
||||
/**
|
||||
* Returns true if the two regions are NOT equal; that is, if operator ==() returns false.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
UBool operator!=(const Region &that) const;
|
||||
|
||||
/**
|
||||
* Returns a pointer to a Region using the given region code. The region code can be either 2-letter ISO code,
|
||||
* 3-letter ISO code, UNM.49 numeric code, or other valid Unicode Region Code as defined by the LDML specification.
|
||||
* The identifier will be canonicalized internally using the supplemental metadata as defined in the CLDR.
|
||||
* If the region code is NULL or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR )
|
||||
* @draft ICU 51
|
||||
*/
|
||||
static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
|
||||
|
||||
/**
|
||||
* Returns a pointer to a Region using the given numeric region code. If the numeric region code is not recognized,
|
||||
* the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ).
|
||||
* @draft ICU 51
|
||||
*/
|
||||
static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status);
|
||||
|
||||
/**
|
||||
* Returns an enumeration over the IDs of all known regions that match the given type.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
static StringEnumeration* U_EXPORT2 getAvailable(URegionType type);
|
||||
|
||||
/**
|
||||
* Returns a pointer to the region that contains this region. Returns NULL if this region is code "001" (World)
|
||||
* or "ZZ" (Unknown region). For example, calling this method with region "IT" (Italy) returns the
|
||||
* region "039" (Southern Europe).
|
||||
* @draft ICU 51
|
||||
*/
|
||||
const Region* getContainingRegion() const;
|
||||
|
||||
/**
|
||||
* Return a pointer to the region that geographically contains this region and matches the given type,
|
||||
* moving multiple steps up the containment chain if necessary. Returns NULL if no containing region can be found
|
||||
* that matches the given type. Note: The URegionTypes = "URGN_GROUPING", "URGN_DEPRECATED", or "URGN_UNKNOWN"
|
||||
* are not appropriate for use in this API. NULL will be returned in this case. For example, calling this method
|
||||
* with region "IT" (Italy) for type "URGN_CONTINENT" returns the region "150" ( Europe ).
|
||||
* @draft ICU 51
|
||||
*/
|
||||
const Region* getContainingRegion(URegionType type) const;
|
||||
|
||||
/**
|
||||
* Return an enumeration over the IDs of all the regions that are immediate children of this region in the
|
||||
* region hierarchy. These returned regions could be either macro regions, territories, or a mixture of the two,
|
||||
* depending on the containment data as defined in CLDR. This API may return NULL if this region doesn't have
|
||||
* any sub-regions. For example, calling this method with region "150" (Europe) returns an enumeration containing
|
||||
* the various sub regions of Europe - "039" (Southern Europe) - "151" (Eastern Europe) - "154" (Northern Europe)
|
||||
* and "155" (Western Europe).
|
||||
* @draft ICU 51
|
||||
*/
|
||||
StringEnumeration* getContainedRegions() const;
|
||||
|
||||
/**
|
||||
* Returns an enumeration over the IDs of all the regions that are children of this region anywhere in the region
|
||||
* hierarchy and match the given type. This API may return an empty enumeration if this region doesn't have any
|
||||
* sub-regions that match the given type. For example, calling this method with region "150" (Europe) and type
|
||||
* "URGN_TERRITORY" returns a set containing all the territories in Europe ( "FR" (France) - "IT" (Italy) - "DE" (Germany) etc. )
|
||||
* @draft ICU 51
|
||||
*/
|
||||
StringEnumeration* getContainedRegions( URegionType type ) const;
|
||||
|
||||
/**
|
||||
* Returns true if this region contains the supplied other region anywhere in the region hierarchy.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
UBool contains(const Region &other) const;
|
||||
|
||||
/**
|
||||
* For deprecated regions, return an enumeration over the IDs of the regions that are the preferred replacement
|
||||
* regions for this region. Returns null for a non-deprecated region. For example, calling this method with region
|
||||
* "SU" (Soviet Union) would return a list of the regions containing "RU" (Russia), "AM" (Armenia), "AZ" (Azerbaijan), etc...
|
||||
* @draft ICU 51
|
||||
*/
|
||||
StringEnumeration* getPreferredValues() const;
|
||||
|
||||
|
||||
/**
|
||||
* Return this region's canonical region code.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
const char* getRegionCode() const;
|
||||
|
||||
/**
|
||||
* Return this region's numeric code. Returns UNDEFINED_NUMERIC_CODE (-1) if the given region does not have a numeric code assigned to it.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
int32_t getNumericCode() const;
|
||||
|
||||
/**
|
||||
* Returns the region type of this region.
|
||||
* @draft ICU 51
|
||||
*/
|
||||
URegionType getType() const;
|
||||
|
||||
/**
|
||||
* ICU "poor man's RTTI", returns a UClassID for this class.
|
||||
*
|
||||
* @draft ICU 51
|
||||
*
|
||||
*/
|
||||
static UClassID U_EXPORT2 getStaticClassID(void);
|
||||
|
||||
/**
|
||||
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
||||
*
|
||||
* @draft ICU 51
|
||||
*/
|
||||
virtual UClassID getDynamicClassID() const;
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Default Destructor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
~Region();
|
||||
|
||||
/**
|
||||
* Cleans up statically allocated memory.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
static void cleanupRegionData();
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
private:
|
||||
char id[4];
|
||||
UnicodeString idStr;
|
||||
int32_t code;
|
||||
URegionType type;
|
||||
Region *containingRegion;
|
||||
UVector *containedRegions;
|
||||
UVector *preferredValues;
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Default Constructor. Internal - use factory methods only.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
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.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
static void loadRegionData();
|
||||
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
#endif /* U_HIDE_DRAFT_API */
|
||||
#endif // REGION_H
|
||||
|
||||
//eof
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,47 +1,47 @@
|
||||
/************************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 2013, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _REGIONTEST_
|
||||
#define _REGIONTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
|
||||
#include "unicode/region.h"
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
* Performs various tests on Region APIs
|
||||
**/
|
||||
class RegionTest: public IntlTest {
|
||||
// IntlTest override
|
||||
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
|
||||
|
||||
public:
|
||||
RegionTest();
|
||||
virtual ~RegionTest();
|
||||
|
||||
void TestKnownRegions(void);
|
||||
void TestGetInstanceString(void);
|
||||
void TestGetInstanceInt(void);
|
||||
void TestGetContainedRegions(void);
|
||||
void TestGetContainedRegionsWithType(void);
|
||||
void TestGetContainingRegion(void);
|
||||
void TestGetContainingRegionWithType(void);
|
||||
void TestGetPreferredValues(void);
|
||||
void TestContains(void);
|
||||
void TestAvailableTerritories(void);
|
||||
|
||||
private:
|
||||
|
||||
UBool optionv; // TRUE if @v option is given on command line
|
||||
};
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
||||
#endif // _REGIONTEST_
|
||||
//eof
|
||||
/************************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 2013, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _REGIONTEST_
|
||||
#define _REGIONTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
|
||||
#include "unicode/region.h"
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
* Performs various tests on Region APIs
|
||||
**/
|
||||
class RegionTest: public IntlTest {
|
||||
// IntlTest override
|
||||
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
|
||||
|
||||
public:
|
||||
RegionTest();
|
||||
virtual ~RegionTest();
|
||||
|
||||
void TestKnownRegions(void);
|
||||
void TestGetInstanceString(void);
|
||||
void TestGetInstanceInt(void);
|
||||
void TestGetContainedRegions(void);
|
||||
void TestGetContainedRegionsWithType(void);
|
||||
void TestGetContainingRegion(void);
|
||||
void TestGetContainingRegionWithType(void);
|
||||
void TestGetPreferredValues(void);
|
||||
void TestContains(void);
|
||||
void TestAvailableTerritories(void);
|
||||
|
||||
private:
|
||||
|
||||
UBool optionv; // TRUE if @v option is given on command line
|
||||
};
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
||||
#endif // _REGIONTEST_
|
||||
//eof
|
||||
|
Loading…
Reference in New Issue
Block a user