]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unumsys.cpp
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *****************************************************************************************
5 * Copyright (C) 2013, International Business Machines Corporation and others.
7 *****************************************************************************************
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_FORMATTING
14 #include "unicode/unumsys.h"
15 #include "unicode/numsys.h"
16 #include "unicode/uenum.h"
21 U_CAPI UNumberingSystem
* U_EXPORT2
22 unumsys_open(const char *locale
, UErrorCode
*status
)
24 // createInstance returns immediately if status indicates error
25 return (UNumberingSystem
*)NumberingSystem::createInstance(Locale(locale
), *status
);
29 U_CAPI UNumberingSystem
* U_EXPORT2
30 unumsys_openByName(const char *name
, UErrorCode
*status
)
32 // createInstanceByName does NOT return immediately if status indicates error
33 if (U_FAILURE(*status
)) {
36 return (UNumberingSystem
*)NumberingSystem::createInstanceByName(name
, *status
);
41 unumsys_close(UNumberingSystem
*unumsys
)
43 delete ((NumberingSystem
*)unumsys
);
47 U_CAPI UEnumeration
* U_EXPORT2
48 unumsys_openAvailableNames(UErrorCode
*status
)
50 // getAvailableNames returns immediately if status indicates error
51 return uenum_openFromStringEnumeration(NumberingSystem::getAvailableNames(*status
), status
);
55 U_CAPI
const char * U_EXPORT2
56 unumsys_getName(const UNumberingSystem
*unumsys
)
58 return ((NumberingSystem
*)unumsys
)->getName();
62 U_CAPI
int32_t U_EXPORT2
63 unumsys_getRadix(const UNumberingSystem
*unumsys
)
65 return ((NumberingSystem
*)unumsys
)->getRadix();
69 U_CAPI UBool U_EXPORT2
70 unumsys_isAlgorithmic(const UNumberingSystem
*unumsys
)
72 return ((NumberingSystem
*)unumsys
)->isAlgorithmic();
75 U_CAPI
int32_t U_EXPORT2
76 unumsys_getDescription(const UNumberingSystem
*unumsys
, UChar
*result
,
77 int32_t resultLength
, UErrorCode
*status
)
79 if (U_FAILURE(*status
)) {
83 UnicodeString descrip
= ((NumberingSystem
*)unumsys
)->getDescription();
84 return descrip
.extract(result
, resultLength
, *status
);
88 #endif /* #if !UCONFIG_NO_FORMATTING */