1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *****************************************************************************************
5 * Copyright (C) 2013-2015, International Business Machines Corporation and others.
7 *****************************************************************************************
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_FORMATTING
14 #include "unicode/uregion.h"
15 #include "unicode/region.h"
16 #include "unicode/uenum.h"
17 #include "unicode/strenum.h"
22 U_CAPI
const URegion
* U_EXPORT2
23 uregion_getRegionFromCode(const char *regionCode
, UErrorCode
*status
)
25 return (URegion
*)Region::getInstance(regionCode
, *status
);
29 U_CAPI
const URegion
* U_EXPORT2
30 uregion_getRegionFromNumericCode (int32_t code
, UErrorCode
*status
)
32 return (URegion
*)Region::getInstance(code
, *status
);
36 U_CAPI UEnumeration
* U_EXPORT2
37 uregion_getAvailable(URegionType type
, UErrorCode
*status
)
39 StringEnumeration
* strenum
= Region::getAvailable(type
, *status
);
40 return uenum_openFromStringEnumeration( strenum
, status
);
44 U_CAPI UBool U_EXPORT2
45 uregion_areEqual(const URegion
* uregion
, const URegion
* otherRegion
)
47 return ( (void*)uregion
== (void*)otherRegion
);
51 U_CAPI
const URegion
* U_EXPORT2
52 uregion_getContainingRegion(const URegion
* uregion
)
54 return (URegion
*)((Region
*)uregion
)->getContainingRegion();
58 U_CAPI
const URegion
* U_EXPORT2
59 uregion_getContainingRegionOfType(const URegion
* uregion
, URegionType type
)
61 return (URegion
*)((Region
*)uregion
)->getContainingRegion(type
);
65 U_CAPI UEnumeration
* U_EXPORT2
66 uregion_getContainedRegions(const URegion
* uregion
, UErrorCode
*status
)
68 StringEnumeration
* strenum
= ((Region
*)uregion
)->getContainedRegions(*status
);
69 return uenum_openFromStringEnumeration( strenum
, status
);
73 U_CAPI UEnumeration
* U_EXPORT2
74 uregion_getContainedRegionsOfType(const URegion
* uregion
, URegionType type
, UErrorCode
*status
)
76 StringEnumeration
* strenum
= ((Region
*)uregion
)->getContainedRegions(type
, *status
);
77 return uenum_openFromStringEnumeration( strenum
, status
);
81 U_CAPI UBool U_EXPORT2
82 uregion_contains(const URegion
* uregion
, const URegion
* otherRegion
)
84 return ((Region
*)uregion
)->contains(*((Region
*)otherRegion
));
88 U_CAPI UEnumeration
* U_EXPORT2
89 uregion_getPreferredValues(const URegion
* uregion
, UErrorCode
*status
)
91 StringEnumeration
* strenum
= ((Region
*)uregion
)->getPreferredValues(*status
);
92 return uenum_openFromStringEnumeration( strenum
, status
);
96 U_CAPI
const char* U_EXPORT2
97 uregion_getRegionCode(const URegion
* uregion
)
99 return ((Region
*)uregion
)->getRegionCode();
103 U_CAPI
int32_t U_EXPORT2
104 uregion_getNumericCode(const URegion
* uregion
)
106 return ((Region
*)uregion
)->getNumericCode();
110 U_CAPI URegionType U_EXPORT2
111 uregion_getType(const URegion
* uregion
)
113 return ((Region
*)uregion
)->getType();
117 #endif /* #if !UCONFIG_NO_FORMATTING */