/*
*****************************************************************************************
-* Copyright (C) 2010 Apple Inc. All Rights Reserved.
+* Copyright (C) 2010-2011 Apple Inc. All Rights Reserved.
*****************************************************************************************
*/
#if !UCONFIG_NO_FORMATTING
+#include "unicode/upluralrules.h"
#include "unicode/uplrule.h"
-#include "unicode/plurrule.h"
-#include "unicode/locid.h"
-#include "unicode/unistr.h"
U_NAMESPACE_USE
uplrule_open(const char *locale,
UErrorCode *status)
{
- if (status == NULL || U_FAILURE(*status)) {
- return 0;
- }
- return (UPluralRules*)PluralRules::forLocale(Locale(locale), *status);
+ return uplrules_open(locale, status);
}
U_CAPI void U_EXPORT2
uplrule_close(UPluralRules *plrules)
{
- delete (PluralRules*)plrules;
+ uplrules_close(plrules);
}
U_CAPI int32_t U_EXPORT2
UChar *keyword, int32_t capacity,
UErrorCode *status)
{
- if (status == NULL || U_FAILURE(*status)) {
- return 0;
- }
- UnicodeString result = ((PluralRules*)plrules)->select(number);
- return result.extract(keyword, capacity, *status);
+ return uplrules_select(plrules, number, keyword, capacity, status);
}
U_CAPI int32_t U_EXPORT2
UChar *keyword, int32_t capacity,
UErrorCode *status)
{
- if (status == NULL || U_FAILURE(*status)) {
- return 0;
- }
- UnicodeString result = ((PluralRules*)plrules)->select(number);
- return result.extract(keyword, capacity, *status);
+ return uplrules_select(plrules, number, keyword, capacity, status);
}
#endif /* #if !UCONFIG_NO_FORMATTING */