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