2 *****************************************************************************************
3 * Copyright (C) 2013-2015, International Business Machines Corporation and others.
5 *****************************************************************************************
8 #include "unicode/utypes.h"
10 #if !UCONFIG_NO_FORMATTING
12 #include "unicode/uregion.h"
13 #include "unicode/region.h"
14 #include "unicode/uenum.h"
15 #include "unicode/strenum.h"
20 U_CAPI
const URegion
* U_EXPORT2
21 uregion_getRegionFromCode(const char *regionCode
, UErrorCode
*status
)
23 return (URegion
*)Region::getInstance(regionCode
, *status
);
27 U_CAPI
const URegion
* U_EXPORT2
28 uregion_getRegionFromNumericCode (int32_t code
, UErrorCode
*status
)
30 return (URegion
*)Region::getInstance(code
, *status
);
34 U_CAPI UEnumeration
* U_EXPORT2
35 uregion_getAvailable(URegionType type
, UErrorCode
*status
)
37 StringEnumeration
* strenum
= Region::getAvailable(type
, *status
);
38 return uenum_openFromStringEnumeration( strenum
, status
);
42 U_CAPI UBool U_EXPORT2
43 uregion_areEqual(const URegion
* uregion
, const URegion
* otherRegion
)
45 return ( (void*)uregion
== (void*)otherRegion
);
49 U_CAPI
const URegion
* U_EXPORT2
50 uregion_getContainingRegion(const URegion
* uregion
)
52 return (URegion
*)((Region
*)uregion
)->getContainingRegion();
56 U_CAPI
const URegion
* U_EXPORT2
57 uregion_getContainingRegionOfType(const URegion
* uregion
, URegionType type
)
59 return (URegion
*)((Region
*)uregion
)->getContainingRegion(type
);
63 U_CAPI UEnumeration
* U_EXPORT2
64 uregion_getContainedRegions(const URegion
* uregion
, UErrorCode
*status
)
66 StringEnumeration
* strenum
= ((Region
*)uregion
)->getContainedRegions(*status
);
67 return uenum_openFromStringEnumeration( strenum
, status
);
71 U_CAPI UEnumeration
* U_EXPORT2
72 uregion_getContainedRegionsOfType(const URegion
* uregion
, URegionType type
, UErrorCode
*status
)
74 StringEnumeration
* strenum
= ((Region
*)uregion
)->getContainedRegions(type
, *status
);
75 return uenum_openFromStringEnumeration( strenum
, status
);
79 U_CAPI UBool U_EXPORT2
80 uregion_contains(const URegion
* uregion
, const URegion
* otherRegion
)
82 return ((Region
*)uregion
)->contains(*((Region
*)otherRegion
));
86 U_CAPI UEnumeration
* U_EXPORT2
87 uregion_getPreferredValues(const URegion
* uregion
, UErrorCode
*status
)
89 StringEnumeration
* strenum
= ((Region
*)uregion
)->getPreferredValues(*status
);
90 return uenum_openFromStringEnumeration( strenum
, status
);
94 U_CAPI
const char* U_EXPORT2
95 uregion_getRegionCode(const URegion
* uregion
)
97 return ((Region
*)uregion
)->getRegionCode();
101 U_CAPI
int32_t U_EXPORT2
102 uregion_getNumericCode(const URegion
* uregion
)
104 return ((Region
*)uregion
)->getNumericCode();
108 U_CAPI URegionType U_EXPORT2
109 uregion_getType(const URegion
* uregion
)
111 return ((Region
*)uregion
)->getType();
115 #endif /* #if !UCONFIG_NO_FORMATTING */