summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/i18n/unumsys.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /intl/icu/source/i18n/unumsys.cpp
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'intl/icu/source/i18n/unumsys.cpp')
-rw-r--r--intl/icu/source/i18n/unumsys.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/intl/icu/source/i18n/unumsys.cpp b/intl/icu/source/i18n/unumsys.cpp
new file mode 100644
index 000000000..f643e342e
--- /dev/null
+++ b/intl/icu/source/i18n/unumsys.cpp
@@ -0,0 +1,88 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*****************************************************************************************
+* Copyright (C) 2013, International Business Machines Corporation and others.
+* All Rights Reserved.
+*****************************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/unumsys.h"
+#include "unicode/numsys.h"
+#include "unicode/uenum.h"
+
+U_NAMESPACE_USE
+
+
+U_CAPI UNumberingSystem* U_EXPORT2
+unumsys_open(const char *locale, UErrorCode *status)
+{
+ // createInstance returns immediately if status indicates error
+ return (UNumberingSystem*)NumberingSystem::createInstance(Locale(locale), *status);
+}
+
+
+U_CAPI UNumberingSystem* U_EXPORT2
+unumsys_openByName(const char *name, UErrorCode *status)
+{
+ // createInstanceByName does NOT return immediately if status indicates error
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ return (UNumberingSystem*)NumberingSystem::createInstanceByName(name, *status);
+}
+
+
+U_CAPI void U_EXPORT2
+unumsys_close(UNumberingSystem *unumsys)
+{
+ delete ((NumberingSystem*)unumsys);
+}
+
+
+U_CAPI UEnumeration* U_EXPORT2
+unumsys_openAvailableNames(UErrorCode *status)
+{
+ // getAvailableNames returns immediately if status indicates error
+ return uenum_openFromStringEnumeration(NumberingSystem::getAvailableNames(*status), status);
+}
+
+
+U_CAPI const char * U_EXPORT2
+unumsys_getName(const UNumberingSystem *unumsys)
+{
+ return ((NumberingSystem*)unumsys)->getName();
+}
+
+
+U_CAPI int32_t U_EXPORT2
+unumsys_getRadix(const UNumberingSystem *unumsys)
+{
+ return ((NumberingSystem*)unumsys)->getRadix();
+}
+
+
+U_CAPI UBool U_EXPORT2
+unumsys_isAlgorithmic(const UNumberingSystem *unumsys)
+{
+ return ((NumberingSystem*)unumsys)->isAlgorithmic();
+}
+
+U_CAPI int32_t U_EXPORT2
+unumsys_getDescription(const UNumberingSystem *unumsys, UChar *result,
+ int32_t resultLength, UErrorCode *status)
+{
+ if (U_FAILURE(*status)) {
+ return -1;
+ }
+ // implement
+ UnicodeString descrip = ((NumberingSystem*)unumsys)->getDescription();
+ return descrip.extract(result, resultLength, *status);
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */