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