]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unumsys.cpp
2 *****************************************************************************************
3 * Copyright (C) 2013, International Business Machines Corporation and others.
5 *****************************************************************************************
8 #include "unicode/utypes.h"
10 #if !UCONFIG_NO_FORMATTING
12 #include "unicode/unumsys.h"
13 #include "unicode/numsys.h"
14 #include "unicode/uenum.h"
19 U_CAPI UNumberingSystem
* U_EXPORT2
20 unumsys_open(const char *locale
, UErrorCode
*status
)
22 // createInstance returns immediately if status indicates error
23 return (UNumberingSystem
*)NumberingSystem::createInstance(Locale(locale
), *status
);
27 U_CAPI UNumberingSystem
* U_EXPORT2
28 unumsys_openByName(const char *name
, UErrorCode
*status
)
30 // createInstanceByName does NOT return immediately if status indicates error
31 if (U_FAILURE(*status
)) {
34 return (UNumberingSystem
*)NumberingSystem::createInstanceByName(name
, *status
);
39 unumsys_close(UNumberingSystem
*unumsys
)
41 delete ((NumberingSystem
*)unumsys
);
45 U_CAPI UEnumeration
* U_EXPORT2
46 unumsys_openAvailableNames(UErrorCode
*status
)
48 // getAvailableNames returns immediately if status indicates error
49 return uenum_openFromStringEnumeration(NumberingSystem::getAvailableNames(*status
), status
);
53 U_CAPI
const char * U_EXPORT2
54 unumsys_getName(const UNumberingSystem
*unumsys
)
56 return ((NumberingSystem
*)unumsys
)->getName();
60 U_CAPI
int32_t U_EXPORT2
61 unumsys_getRadix(const UNumberingSystem
*unumsys
)
63 return ((NumberingSystem
*)unumsys
)->getRadix();
67 U_CAPI UBool U_EXPORT2
68 unumsys_isAlgorithmic(const UNumberingSystem
*unumsys
)
70 return ((NumberingSystem
*)unumsys
)->isAlgorithmic();
73 U_CAPI
int32_t U_EXPORT2
74 unumsys_getDescription(const UNumberingSystem
*unumsys
, UChar
*result
,
75 int32_t resultLength
, UErrorCode
*status
)
77 if (U_FAILURE(*status
)) {
81 UnicodeString descrip
= ((NumberingSystem
*)unumsys
)->getDescription();
82 return descrip
.extract(result
, resultLength
, *status
);
86 #endif /* #if !UCONFIG_NO_FORMATTING */