]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/uregion.cpp
ICU-511.32.tar.gz
[apple/icu.git] / icuSources / i18n / uregion.cpp
1 /*
2 *****************************************************************************************
3 * Copyright (C) 2013, International Business Machines Corporation and others.
4 * All Rights Reserved.
5 *****************************************************************************************
6 */
7
8 #include "unicode/utypes.h"
9
10 #if !UCONFIG_NO_FORMATTING
11
12 #include "unicode/uregion.h"
13 #include "unicode/region.h"
14 #include "unicode/uenum.h"
15
16 U_NAMESPACE_USE
17
18
19 U_CAPI const URegion* U_EXPORT2
20 uregion_getRegionFromCode(const char *regionCode, UErrorCode *status)
21 {
22 return (URegion*)Region::getInstance(regionCode, *status);
23 }
24
25
26 U_CAPI const URegion* U_EXPORT2
27 uregion_getRegionFromNumericCode (int32_t code, UErrorCode *status)
28 {
29 return (URegion*)Region::getInstance(code, *status);
30 }
31
32
33 U_CAPI UEnumeration* U_EXPORT2
34 uregion_getAvailable(URegionType type, UErrorCode *status)
35 {
36 return uenum_openFromStringEnumeration( Region::getAvailable(type), status );
37 }
38
39
40 U_CAPI UBool U_EXPORT2
41 uregion_areEqual(const URegion* uregion, const URegion* otherRegion)
42 {
43 return ( (void*)uregion == (void*)otherRegion );
44 }
45
46
47 U_CAPI const URegion* U_EXPORT2
48 uregion_getContainingRegion(const URegion* uregion)
49 {
50 return (URegion*)((Region*)uregion)->getContainingRegion();
51 }
52
53
54 U_CAPI const URegion* U_EXPORT2
55 uregion_getContainingRegionOfType(const URegion* uregion, URegionType type)
56 {
57 return (URegion*)((Region*)uregion)->getContainingRegion(type);
58 }
59
60
61 U_CAPI UEnumeration* U_EXPORT2
62 uregion_getContainedRegions(const URegion* uregion, UErrorCode *status)
63 {
64 return uenum_openFromStringEnumeration( ((Region*)uregion)->getContainedRegions(), status);
65 }
66
67
68 U_CAPI UEnumeration* U_EXPORT2
69 uregion_getContainedRegionsOfType(const URegion* uregion, URegionType type, UErrorCode *status)
70 {
71 return uenum_openFromStringEnumeration( ((Region*)uregion)->getContainedRegions(type), status);
72 }
73
74
75 U_CAPI UBool U_EXPORT2
76 uregion_contains(const URegion* uregion, const URegion* otherRegion)
77 {
78 return ((Region*)uregion)->contains(*((Region*)otherRegion));
79 }
80
81
82 U_CAPI UEnumeration* U_EXPORT2
83 uregion_getPreferredValues(const URegion* uregion, UErrorCode *status)
84 {
85 return uenum_openFromStringEnumeration( ((Region*)uregion)->getPreferredValues(), status);
86 }
87
88
89 U_CAPI const char* U_EXPORT2
90 uregion_getRegionCode(const URegion* uregion)
91 {
92 return ((Region*)uregion)->getRegionCode();
93 }
94
95
96 U_CAPI int32_t U_EXPORT2
97 uregion_getNumericCode(const URegion* uregion)
98 {
99 return ((Region*)uregion)->getNumericCode();
100 }
101
102
103 U_CAPI URegionType U_EXPORT2
104 uregion_getType(const URegion* uregion)
105 {
106 return ((Region*)uregion)->getType();
107 }
108
109
110 #endif /* #if !UCONFIG_NO_FORMATTING */