Home | History | Annotate | Download | only in i18n
      1 /*
      2 *****************************************************************************************
      3 * Copyright (C) 2013-2015, 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 #include "unicode/strenum.h"
     16 
     17 U_NAMESPACE_USE
     18 
     19 
     20 U_CAPI const URegion* U_EXPORT2
     21 uregion_getRegionFromCode(const char *regionCode, UErrorCode *status)
     22 {
     23     return (URegion*)Region::getInstance(regionCode, *status);
     24 }
     25 
     26 
     27 U_CAPI const URegion* U_EXPORT2
     28 uregion_getRegionFromNumericCode (int32_t code, UErrorCode *status)
     29 {
     30     return (URegion*)Region::getInstance(code, *status);
     31 }
     32 
     33 
     34 U_CAPI UEnumeration* U_EXPORT2
     35 uregion_getAvailable(URegionType type, UErrorCode *status)
     36 {
     37     StringEnumeration* strenum = Region::getAvailable(type, *status);
     38     return uenum_openFromStringEnumeration( strenum, status );
     39 }
     40 
     41 
     42 U_CAPI UBool U_EXPORT2
     43 uregion_areEqual(const URegion* uregion, const URegion* otherRegion)
     44 {
     45     return ( (void*)uregion == (void*)otherRegion );
     46 }
     47 
     48 
     49 U_CAPI const URegion* U_EXPORT2
     50 uregion_getContainingRegion(const URegion* uregion)
     51 {
     52     return (URegion*)((Region*)uregion)->getContainingRegion();
     53 }
     54 
     55 
     56 U_CAPI const URegion* U_EXPORT2
     57 uregion_getContainingRegionOfType(const URegion* uregion, URegionType type)
     58 {
     59     return (URegion*)((Region*)uregion)->getContainingRegion(type);
     60 }
     61 
     62 
     63 U_CAPI UEnumeration* U_EXPORT2
     64 uregion_getContainedRegions(const URegion* uregion, UErrorCode *status)
     65 {
     66     StringEnumeration* strenum = ((Region*)uregion)->getContainedRegions(*status);
     67     return uenum_openFromStringEnumeration( strenum, status);
     68 }
     69 
     70 
     71 U_CAPI UEnumeration* U_EXPORT2
     72 uregion_getContainedRegionsOfType(const URegion* uregion, URegionType type, UErrorCode *status)
     73 {
     74     StringEnumeration* strenum = ((Region*)uregion)->getContainedRegions(type, *status);
     75     return uenum_openFromStringEnumeration( strenum, status);
     76 }
     77 
     78 
     79 U_CAPI UBool U_EXPORT2
     80 uregion_contains(const URegion* uregion, const URegion* otherRegion)
     81 {
     82     return ((Region*)uregion)->contains(*((Region*)otherRegion));
     83 }
     84 
     85 
     86 U_CAPI UEnumeration* U_EXPORT2
     87 uregion_getPreferredValues(const URegion* uregion, UErrorCode *status)
     88 {
     89     StringEnumeration* strenum = ((Region*)uregion)->getPreferredValues(*status);
     90     return uenum_openFromStringEnumeration( strenum, status);
     91 }
     92 
     93 
     94 U_CAPI const char* U_EXPORT2
     95 uregion_getRegionCode(const URegion* uregion)
     96 {
     97     return ((Region*)uregion)->getRegionCode();
     98 }
     99 
    100 
    101 U_CAPI int32_t U_EXPORT2
    102 uregion_getNumericCode(const URegion* uregion)
    103 {
    104     return ((Region*)uregion)->getNumericCode();
    105 }
    106 
    107 
    108 U_CAPI URegionType U_EXPORT2
    109 uregion_getType(const URegion* uregion)
    110 {
    111     return ((Region*)uregion)->getType();
    112 }
    113 
    114 
    115 #endif /* #if !UCONFIG_NO_FORMATTING */
    116