Commit b3869dd8 authored by Andi Vajda's avatar Andi Vajda
Browse files

- added wrapper for UnicodeSetIterator::skipToStrings()

  - added wrapper for DisplayOptions, DisplayOptions::Builder and related enums
  - added wrapper for FormattedNumber::getNounClass()
  - added wrapper for NumberFormatter.displayOptions()
parent 8331f889
......@@ -4,6 +4,10 @@ Version 2.9 ->
- added wrapper for u_cleanup/u_init sequence as ResourceBundle.resetICU()
- added wrapper for TimeZone.getRegion()
- added support for ICU 72rc
- added wrapper for UnicodeSetIterator::skipToStrings()
- added wrapper for DisplayOptions, DisplayOptions::Builder and related enums
- added wrapper for FormattedNumber::getNounClass()
- added wrapper for NumberFormatter.displayOptions()
-
Version 2.8.1 -> 2.9
......
......@@ -11,6 +11,7 @@ include charset.h
include collator.h
include common.h
include dateformat.h
include displayoptions.h
include errors.h
include format.h
include gender.h
......
......@@ -32,6 +32,7 @@
#include "iterators.h"
#include "format.h"
#include "dateformat.h"
#include "displayoptions.h"
#include "messagepattern.h"
#include "numberformat.h"
#include "timezone.h"
......@@ -250,6 +251,7 @@ static PyObject *PyInit_icu_(PyObject *m)
_init_iterators(m);
_init_format(m);
_init_dateformat(m);
_init_displayoptions(m);
_init_messagepattern(m);
_init_numberformat(m);
_init_timezone(m);
......
......@@ -1504,6 +1504,15 @@ void _init_char(PyObject *m)
INSTALL_ENUM(UBlockCode, "UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED_A", UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED_A);
INSTALL_ENUM(UBlockCode, "VITHKUQI", UBLOCK_VITHKUQI);
INSTALL_ENUM(UBlockCode, "ZNAMENNY_MUSICAL_NOTATION", UBLOCK_ZNAMENNY_MUSICAL_NOTATION);
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
INSTALL_ENUM(UBlockCode, "ARABIC_EXTENDED_C", UBLOCK_ARABIC_EXTENDED_C);
INSTALL_ENUM(UBlockCode, "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_H", UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_H);
INSTALL_ENUM(UBlockCode, "CYRILLIC_EXTENDED_D", UBLOCK_CYRILLIC_EXTENDED_D);
INSTALL_ENUM(UBlockCode, "DEVANAGARI_EXTENDED_A", UBLOCK_DEVANAGARI_EXTENDED_A);
INSTALL_ENUM(UBlockCode, "KAKTOVIK_NUMERALS", UBLOCK_KAKTOVIK_NUMERALS);
INSTALL_ENUM(UBlockCode, "KAWI", UBLOCK_KAWI);
INSTALL_ENUM(UBlockCode, "NAG_MUNDARI", UBLOCK_NAG_MUNDARI);
#endif
INSTALL_ENUM(UBlockCode, "INVALID_CODE", UBLOCK_INVALID_CODE);
......
......@@ -265,6 +265,10 @@ typedef intintobjargproc ssizessizeobjargproc;
#include <unicode/localematcher.h>
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
#include <unicode/displayoptions.h>
#endif
#if U_ICU_VERSION_HEX < 0x04060000
typedef UClassID classid;
......
/* ====================================================================
* Copyright (c) 2022-2022 Open Source Applications Foundation.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
#include "common.h"
#include "structmember.h"
#include "bases.h"
#include "locale.h"
#include "format.h"
#include "displayoptions.h"
#include "macros.h"
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
DECLARE_CONSTANTS_TYPE(UDisplayOptionsGrammaticalCase)
DECLARE_CONSTANTS_TYPE(UDisplayOptionsNounClass)
DECLARE_CONSTANTS_TYPE(UDisplayOptionsPluralCategory)
DECLARE_CONSTANTS_TYPE(UDisplayOptionsCapitalization)
DECLARE_CONSTANTS_TYPE(UDisplayOptionsNameStyle)
DECLARE_CONSTANTS_TYPE(UDisplayOptionsDisplayLength)
DECLARE_CONSTANTS_TYPE(UDisplayOptionsSubstituteHandling)
using DisplayOptionsBuilder = DisplayOptions::Builder;
/* DisplayOptionsBuilder */
class t_displayoptionsbuilder : public _wrapper {
public:
DisplayOptionsBuilder *object;
};
static PyObject *t_displayoptionsbuilder_setGrammaticalCase(t_displayoptionsbuilder *self, PyObject *arg);
static PyObject *t_displayoptionsbuilder_setNounClass(t_displayoptionsbuilder *self, PyObject *arg);
static PyObject *t_displayoptionsbuilder_setPluralCategory(t_displayoptionsbuilder *self, PyObject *arg);
static PyObject *t_displayoptionsbuilder_setCapitalization(t_displayoptionsbuilder *self, PyObject *arg);
static PyObject *t_displayoptionsbuilder_setNameStyle(t_displayoptionsbuilder *self, PyObject *arg);
static PyObject *t_displayoptionsbuilder_setDisplayLength(t_displayoptionsbuilder *self, PyObject *arg);
static PyObject *t_displayoptionsbuilder_setSubstituteHandling(t_displayoptionsbuilder *self, PyObject *arg);
static PyObject *t_displayoptionsbuilder_build(t_displayoptionsbuilder *self);
static PyMethodDef t_displayoptionsbuilder_methods[] = {
DECLARE_METHOD(t_displayoptionsbuilder, setGrammaticalCase, METH_O),
DECLARE_METHOD(t_displayoptionsbuilder, setNounClass, METH_O),
DECLARE_METHOD(t_displayoptionsbuilder, setPluralCategory, METH_O),
DECLARE_METHOD(t_displayoptionsbuilder, setCapitalization, METH_O),
DECLARE_METHOD(t_displayoptionsbuilder, setNameStyle, METH_O),
DECLARE_METHOD(t_displayoptionsbuilder, setDisplayLength, METH_O),
DECLARE_METHOD(t_displayoptionsbuilder, setSubstituteHandling, METH_O),
DECLARE_METHOD(t_displayoptionsbuilder, build, METH_NOARGS),
{ NULL, NULL, 0, NULL }
};
DECLARE_BY_VALUE_TYPE(DisplayOptionsBuilder, t_displayoptionsbuilder, UMemory,
DisplayOptionsBuilder, abstract_init)
/* DisplayOptions */
static PyObject *t_displayoptions_builder(PyTypeObject *type);
static PyObject *t_displayoptions_copyToBuilder(t_displayoptions *self);
static PyObject *t_displayoptions_getGrammaticalCase(t_displayoptions *self);
static PyObject *t_displayoptions_getNounClass(t_displayoptions *self);
static PyObject *t_displayoptions_getPluralCategory(t_displayoptions *self);
static PyObject *t_displayoptions_getCapitalization(t_displayoptions *self);
static PyObject *t_displayoptions_getNameStyle(t_displayoptions *self);
static PyObject *t_displayoptions_getDisplayLength(t_displayoptions *self);
static PyObject *t_displayoptions_getSubstituteHandling(t_displayoptions *self);
static PyMethodDef t_displayoptions_methods[] = {
DECLARE_METHOD(t_displayoptions, builder, METH_CLASS | METH_NOARGS),
DECLARE_METHOD(t_displayoptions, copyToBuilder, METH_NOARGS),
DECLARE_METHOD(t_displayoptions, getGrammaticalCase, METH_NOARGS),
DECLARE_METHOD(t_displayoptions, getNounClass, METH_NOARGS),
DECLARE_METHOD(t_displayoptions, getPluralCategory, METH_NOARGS),
DECLARE_METHOD(t_displayoptions, getCapitalization, METH_NOARGS),
DECLARE_METHOD(t_displayoptions, getNameStyle, METH_NOARGS),
DECLARE_METHOD(t_displayoptions, getDisplayLength, METH_NOARGS),
DECLARE_METHOD(t_displayoptions, getSubstituteHandling, METH_NOARGS),
{ NULL, NULL, 0, NULL }
};
DECLARE_BY_VALUE_TYPE(DisplayOptions, t_displayoptions, UMemory,
DisplayOptions, abstract_init)
/* DisplayOptionsBuilder */
#define DEFINE_DISPLAY_OPTIONS_SETTER(name) \
static PyObject *t_displayoptionsbuilder_set##name( \
t_displayoptionsbuilder *self, PyObject *arg) \
{ \
UDisplayOptions##name option; \
\
if (!parseArg(arg, "i", &option)) \
{ \
self->object->set##name(option); \
Py_RETURN_SELF(); \
} \
\
return PyErr_SetArgsError((PyObject *) self, "set"#name, arg); \
}
DEFINE_DISPLAY_OPTIONS_SETTER(GrammaticalCase)
DEFINE_DISPLAY_OPTIONS_SETTER(NounClass)
DEFINE_DISPLAY_OPTIONS_SETTER(PluralCategory)
DEFINE_DISPLAY_OPTIONS_SETTER(Capitalization)
DEFINE_DISPLAY_OPTIONS_SETTER(NameStyle)
DEFINE_DISPLAY_OPTIONS_SETTER(DisplayLength)
DEFINE_DISPLAY_OPTIONS_SETTER(SubstituteHandling)
static PyObject *t_displayoptionsbuilder_build(t_displayoptionsbuilder *self)
{
return wrap_DisplayOptions(self->object->build());
}
/* DisplayOptions */
static PyObject *t_displayoptions_builder(PyTypeObject *type)
{
return wrap_DisplayOptionsBuilder(DisplayOptions::builder());
}
static PyObject *t_displayoptions_copyToBuilder(t_displayoptions *self)
{
return wrap_DisplayOptionsBuilder(self->object->copyToBuilder());
}
#define DEFINE_DISPLAY_OPTIONS_GETTER(name) \
static PyObject *t_displayoptions_get##name(t_displayoptions *self) \
{ \
UDisplayOptions##name option = self->object->get##name(); \
return PyInt_FromLong(option); \
}
DEFINE_DISPLAY_OPTIONS_GETTER(GrammaticalCase)
DEFINE_DISPLAY_OPTIONS_GETTER(NounClass)
DEFINE_DISPLAY_OPTIONS_GETTER(PluralCategory)
DEFINE_DISPLAY_OPTIONS_GETTER(Capitalization)
DEFINE_DISPLAY_OPTIONS_GETTER(NameStyle)
DEFINE_DISPLAY_OPTIONS_GETTER(DisplayLength)
DEFINE_DISPLAY_OPTIONS_GETTER(SubstituteHandling)
#endif
void _init_displayoptions(PyObject *m)
{
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
INSTALL_STRUCT(DisplayOptionsBuilder, m);
INSTALL_STRUCT(DisplayOptions, m);
PyDict_SetItemString(DisplayOptionsType_.tp_dict, "Builder",
(PyObject *) &DisplayOptionsBuilderType_);
INSTALL_CONSTANTS_TYPE(UDisplayOptionsGrammaticalCase, m);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "UNDEFINED", UDISPOPT_GRAMMATICAL_CASE_UNDEFINED);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "ABLATIVE", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "ACCUSATIVE", UDISPOPT_GRAMMATICAL_CASE_ACCUSATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "COMITATIVE", UDISPOPT_GRAMMATICAL_CASE_COMITATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "DATIVE", UDISPOPT_GRAMMATICAL_CASE_DATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "ERGATIVE", UDISPOPT_GRAMMATICAL_CASE_ERGATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "GENITIVE", UDISPOPT_GRAMMATICAL_CASE_GENITIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "INSTRUMENTAL", UDISPOPT_GRAMMATICAL_CASE_INSTRUMENTAL);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "LOCATIVE", UDISPOPT_GRAMMATICAL_CASE_LOCATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "LOCATIVE_COPULATIVE", UDISPOPT_GRAMMATICAL_CASE_LOCATIVE_COPULATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "NOMINATIVE", UDISPOPT_GRAMMATICAL_CASE_NOMINATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "OBLIQUE", UDISPOPT_GRAMMATICAL_CASE_OBLIQUE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "PREPOSITIONAL", UDISPOPT_GRAMMATICAL_CASE_PREPOSITIONAL);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "SOCIATIVE", UDISPOPT_GRAMMATICAL_CASE_SOCIATIVE);
INSTALL_ENUM(UDisplayOptionsGrammaticalCase, "VOCATIVE", UDISPOPT_GRAMMATICAL_CASE_VOCATIVE);
INSTALL_CONSTANTS_TYPE(UDisplayOptionsNounClass, m);
INSTALL_ENUM(UDisplayOptionsNounClass, "UNDEFINED", UDISPOPT_NOUN_CLASS_UNDEFINED);
INSTALL_ENUM(UDisplayOptionsNounClass, "OTHER", UDISPOPT_NOUN_CLASS_OTHER);
INSTALL_ENUM(UDisplayOptionsNounClass, "NEUTER", UDISPOPT_NOUN_CLASS_NEUTER);
INSTALL_ENUM(UDisplayOptionsNounClass, "FEMININE", UDISPOPT_NOUN_CLASS_FEMININE);
INSTALL_ENUM(UDisplayOptionsNounClass, "MASCULINE", UDISPOPT_NOUN_CLASS_MASCULINE);
INSTALL_ENUM(UDisplayOptionsNounClass, "ANIMATE", UDISPOPT_NOUN_CLASS_ANIMATE);
INSTALL_ENUM(UDisplayOptionsNounClass, "INANIMATE", UDISPOPT_NOUN_CLASS_INANIMATE);
INSTALL_ENUM(UDisplayOptionsNounClass, "PERSONAL", UDISPOPT_NOUN_CLASS_PERSONAL);
INSTALL_ENUM(UDisplayOptionsNounClass, "COMMON", UDISPOPT_NOUN_CLASS_COMMON);
INSTALL_CONSTANTS_TYPE(UDisplayOptionsPluralCategory, m);
INSTALL_ENUM(UDisplayOptionsPluralCategory, "UNDEFINED", UDISPOPT_PLURAL_CATEGORY_UNDEFINED);
INSTALL_ENUM(UDisplayOptionsPluralCategory, "ZERO", UDISPOPT_PLURAL_CATEGORY_ZERO);
INSTALL_ENUM(UDisplayOptionsPluralCategory, "ONE", UDISPOPT_PLURAL_CATEGORY_ONE);
INSTALL_ENUM(UDisplayOptionsPluralCategory, "TWO", UDISPOPT_PLURAL_CATEGORY_TWO);
INSTALL_ENUM(UDisplayOptionsPluralCategory, "FEW", UDISPOPT_PLURAL_CATEGORY_FEW);
INSTALL_ENUM(UDisplayOptionsPluralCategory, "MANY", UDISPOPT_PLURAL_CATEGORY_MANY);
INSTALL_ENUM(UDisplayOptionsPluralCategory, "OTHER", UDISPOPT_PLURAL_CATEGORY_OTHER);
INSTALL_CONSTANTS_TYPE(UDisplayOptionsCapitalization, m);
INSTALL_ENUM(UDisplayOptionsCapitalization, "UNDEFINED", UDISPOPT_CAPITALIZATION_UNDEFINED);
INSTALL_ENUM(UDisplayOptionsCapitalization, "BEGINNING_OF_SENTENCE", UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE);
INSTALL_ENUM(UDisplayOptionsCapitalization, "MIDDLE_OF_SENTENCE", UDISPOPT_CAPITALIZATION_MIDDLE_OF_SENTENCE);
INSTALL_ENUM(UDisplayOptionsCapitalization, "STANDALONE", UDISPOPT_CAPITALIZATION_STANDALONE);
INSTALL_ENUM(UDisplayOptionsCapitalization, "UI_LIST_OR_MENU", UDISPOPT_CAPITALIZATION_UI_LIST_OR_MENU);
INSTALL_CONSTANTS_TYPE(UDisplayOptionsNameStyle, m);
INSTALL_ENUM(UDisplayOptionsNameStyle, "UNDEFINED", UDISPOPT_NAME_STYLE_UNDEFINED);
INSTALL_ENUM(UDisplayOptionsNameStyle, "STANDARD_NAMES", UDISPOPT_NAME_STYLE_STANDARD_NAMES);
INSTALL_ENUM(UDisplayOptionsNameStyle, "DIALECT_NAMES", UDISPOPT_NAME_STYLE_DIALECT_NAMES);
INSTALL_CONSTANTS_TYPE(UDisplayOptionsDisplayLength, m);
INSTALL_ENUM(UDisplayOptionsDisplayLength, "UNDEFINED", UDISPOPT_DISPLAY_LENGTH_UNDEFINED);
INSTALL_ENUM(UDisplayOptionsDisplayLength, "FULL", UDISPOPT_DISPLAY_LENGTH_FULL);
INSTALL_ENUM(UDisplayOptionsDisplayLength, "SHORT", UDISPOPT_DISPLAY_LENGTH_SHORT);
INSTALL_CONSTANTS_TYPE(UDisplayOptionsSubstituteHandling, m);
INSTALL_ENUM(UDisplayOptionsSubstituteHandling, "UNDEFINED", UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED);
INSTALL_ENUM(UDisplayOptionsSubstituteHandling, "SUBSTITUTE", UDISPOPT_SUBSTITUTE_HANDLING_SUBSTITUTE);
INSTALL_ENUM(UDisplayOptionsSubstituteHandling, "NO_SUBSTITUTE", UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE);
#endif
}
/* ====================================================================
* Copyright (c) 2022-2022 Open Source Applications Foundation.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
#ifndef _displayoptions_h
#define _displayoptions_h
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
extern PyTypeObject DisplayOptionsType_;
class t_displayoptions : public _wrapper {
public:
DisplayOptions *object;
};
void _init_displayoptions(PyObject *m);
#endif // ICU >= 72
#endif /* _displayoptions_h */
......@@ -436,7 +436,7 @@ using LocaleMatcherResult = LocaleMatcher::Result;
class t_localematcherbuilder : public _wrapper {
public:
LocaleMatcherBuilder *object;
LocaleMatcherBuilder *object;
};
static int t_localematcherbuilder_init(t_localematcherbuilder *self, PyObject *args, PyObject *kwds);
......
......@@ -279,6 +279,12 @@ static PyObject *t_measureunit_createMilligramOfglucosePerDeciliter(PyTypeObject
#if U_ICU_VERSION_HEX >= VERSION_HEX(70, 0, 0)
static PyObject *t_measureunit_createKilowattHourPer100Kilometer(PyTypeObject *type);
static PyObject *t_measureunit_createItem(PyTypeObject *type);
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
static PyObject *t_measureunit_createQuarter(PyTypeObject *type);
static PyObject *t_measureunit_createTonne(PyTypeObject *type);
#endif
static PyMethodDef t_measureunit_methods[] = {
......@@ -509,6 +515,11 @@ static PyMethodDef t_measureunit_methods[] = {
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(70, 0, 0)
DECLARE_METHOD(t_measureunit, createKilowattHourPer100Kilometer, METH_NOARGS | METH_CLASS),
DECLARE_METHOD(t_measureunit, createItem, METH_NOARGS | METH_CLASS),
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
DECLARE_METHOD(t_measureunit, createQuarter, METH_NOARGS | METH_CLASS),
DECLARE_METHOD(t_measureunit, createTonne, METH_NOARGS | METH_CLASS),
#endif
{ NULL, NULL, 0, NULL }
};
......@@ -1125,6 +1136,12 @@ createMU(MilligramOfglucosePerDeciliter)
#if U_ICU_VERSION_HEX >= VERSION_HEX(70, 0, 0)
createMU(KilowattHourPer100Kilometer)
createMU(Item)
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
createMU(Quarter)
createMU(Tonne)
#endif
/* Measure */
......
......@@ -25,6 +25,7 @@
#include "structmember.h"
#include "bases.h"
#include "displayoptions.h"
#include "locale.h"
#include "format.h"
#include "numberformat.h"
......@@ -588,10 +589,16 @@ DECLARE_CONSTANTS_TYPE(UNumberUnitWidth)
#if U_ICU_VERSION_HEX >= VERSION_HEX(68, 0, 0)
static PyObject *t_formattednumber_getOutputUnit(t_formattednumber *self);
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
static PyObject *t_formattednumber_getNounClass(t_formattednumber *self);
#endif
static PyMethodDef t_formattednumber_methods[] = {
#if U_ICU_VERSION_HEX >= VERSION_HEX(68, 0, 0)
DECLARE_METHOD(t_formattednumber, getOutputUnit, METH_NOARGS),
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
DECLARE_METHOD(t_formattednumber, getNounClass, METH_NOARGS),
#endif
{ NULL, NULL, 0, NULL }
};
......@@ -712,6 +719,11 @@ static PyObject *t_unlocalizednumberformatter_locale(
static PyObject *t_unlocalizednumberformatter_usage(
t_unlocalizednumberformatter *self, PyObject *arg);
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
static PyObject *t_unlocalizednumberformatter_displayOptions(
t_unlocalizednumberformatter *self, PyObject *arg);
#endif
static PyMethodDef t_unlocalizednumberformatter_methods[] = {
DECLARE_METHOD(t_unlocalizednumberformatter, unit, METH_O),
......@@ -739,6 +751,9 @@ static PyMethodDef t_unlocalizednumberformatter_methods[] = {
DECLARE_METHOD(t_unlocalizednumberformatter, locale, METH_O),
#if U_ICU_VERSION_HEX >= VERSION_HEX(68, 0, 0)
DECLARE_METHOD(t_unlocalizednumberformatter, usage, METH_O),
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
DECLARE_METHOD(t_unlocalizednumberformatter, displayOptions, METH_O),
#endif
{ NULL, NULL, 0, NULL }
};
......@@ -815,6 +830,10 @@ static PyObject *t_localizednumberformatter_formatDecimalToValue(
static PyObject *t_localizednumberformatter_usage(
t_localizednumberformatter *self, PyObject *arg);
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
static PyObject *t_localizednumberformatter_displayOptions(
t_localizednumberformatter *self, PyObject *arg);
#endif
static PyMethodDef t_localizednumberformatter_methods[] = {
DECLARE_METHOD(t_localizednumberformatter, unit, METH_O),
......@@ -849,6 +868,9 @@ static PyMethodDef t_localizednumberformatter_methods[] = {
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(68, 0, 0)
DECLARE_METHOD(t_localizednumberformatter, usage, METH_O),
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
DECLARE_METHOD(t_localizednumberformatter, displayOptions, METH_O),
#endif
{ NULL, NULL, 0, NULL }
};
......@@ -3806,6 +3828,24 @@ static PyObject *t_unlocalizednumberformatter_usage(
#endif // ICU >= 68
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
static PyObject *t_unlocalizednumberformatter_displayOptions(
t_unlocalizednumberformatter *self, PyObject *arg)
{
PyObject *displayOptions;
if (!parseArg(arg, "O", &DisplayOptionsType_, &displayOptions))
{
return wrap_UnlocalizedNumberFormatter(
self->object->displayOptions(*((t_displayoptions *) displayOptions)->object));
}
return PyErr_SetArgsError((PyObject *) self, "displayOptions", arg);
}
#endif // ICU >= 72
/* LocalizedNumberFormatter */
......@@ -4231,6 +4271,24 @@ static PyObject *t_localizednumberformatter_usage(
#endif // ICU >= 68
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
static PyObject *t_localizednumberformatter_displayOptions(
t_localizednumberformatter *self, PyObject *arg)
{
PyObject *displayOptions;
if (!parseArg(arg, "O", &DisplayOptionsType_, &displayOptions))
{
return wrap_LocalizedNumberFormatter(
self->object->displayOptions(*((t_displayoptions *) displayOptions)->object));
}
return PyErr_SetArgsError((PyObject *) self, "displayOptions", arg);
}
#endif // ICU >= 72
/* Notation */
static PyObject *t_notation_scientific(PyTypeObject *type, PyObject *args)
......@@ -5283,10 +5341,10 @@ static PyObject *t_localizednumberrangeformatter_formatFormattableRangeToValue(
#endif // ICU >= 63
#if U_ICU_VERSION_HEX >= VERSION_HEX(68, 0, 0)
/* FormattedNumber */
#if U_ICU_VERSION_HEX >= VERSION_HEX(68, 0, 0)
static PyObject *t_formattednumber_getOutputUnit(t_formattednumber *self)
{
MeasureUnit mu;
......@@ -5298,6 +5356,19 @@ static PyObject *t_formattednumber_getOutputUnit(t_formattednumber *self)
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
static PyObject *t_formattednumber_getNounClass(t_formattednumber *self)
{
UDisplayOptionsNounClass nc;
STATUS_CALL(nc = self->object->getNounClass(status));
return PyInt_FromLong(nc);
}
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(64, 0, 0)
......@@ -5517,8 +5588,8 @@ void _init_numberformat(PyObject *m)
INSTALL_ENUM(UNumberRoundingPriority, "STRICT", UNUM_ROUNDING_PRIORITY_STRICT);
INSTALL_CONSTANTS_TYPE(UNumberTrailingZeroDisplay, m);
INSTALL_ENUM(UNumberRoundingPriority, "AUTO", UNUM_TRAILING_ZERO_AUTO);
INSTALL_ENUM(UNumberRoundingPriority, "HIDE_IF_WHOLE", UNUM_TRAILING_ZERO_HIDE_IF_WHOLE);
INSTALL_ENUM(UNumberTrailingZeroDisplay, "AUTO", UNUM_TRAILING_ZERO_AUTO);
INSTALL_ENUM(UNumberTrailingZeroDisplay, "HIDE_IF_WHOLE", UNUM_TRAILING_ZERO_HIDE_IF_WHOLE);
#endif
INSTALL_CONSTANTS_TYPE(UNumberFormatStyle, m);
......
......@@ -585,6 +585,10 @@ void _init_script(PyObject *m)
INSTALL_ENUM(UScriptCode, "TOTO", USCRIPT_TOTO);
INSTALL_ENUM(UScriptCode, "VITHKUQI", USCRIPT_VITHKUQI);
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(72, 0, 0)
INSTALL_ENUM(UScriptCode, "KAWI", USCRIPT_KAWI);
INSTALL_ENUM(UScriptCode, "NAG_MUNDARI", USCRIPT_NAG_MUNDARI);
#endif
#if U_ICU_VERSION_HEX >= VERSION_HEX(51, 0, 0)
INSTALL_ENUM(UScriptUsage, "NOT_ENCODED", USCRIPT_USAGE_NOT_ENCODED);
......
......@@ -223,6 +223,9 @@ static PyObject *t_unicodesetiterator_next(t_unicodesetiterator *self);
static PyObject *t_unicodesetiterator_nextRange(t_unicodesetiterator *self);
static PyObject *t_unicodesetiterator_reset(t_unicodesetiterator *self,
PyObject *args);
#if U_ICU_VERSION_HEX >= VERSION_HEX(70, 0, 0)
static PyObject *t_unicodesetiterator_skipToStrings(t_unicodesetiterator *self);
#endif
static PyMethodDef t_unicodesetiterator_methods[] = {
DECLARE_METHOD(t_unicodesetiterator, isString, METH_NOARGS),
......@@ -232,6 +235,9 @@ static PyMethodDef t_unicodesetiterator_methods[] = {
DECLARE_METHOD(t_unicodesetiterator, next, METH_NOARGS),
DECLARE_METHOD(t_unicodesetiterator, nextRange, METH_NOARGS),
DECLARE_METHOD(t_unicodesetiterator, reset, METH_VARARGS),
#if U_ICU_VERSION_HEX >= VERSION_HEX(70, 0, 0)
DECLARE_METHOD(t_unicodesetiterator, skipToStrings, METH_NOARGS),
#endif
{ NULL, NULL, 0, NULL }
};
......@@ -1327,6 +1333,14 @@ static PyObject *t_unicodesetiterator_reset(t_unicodesetiterator *self,
return PyErr_SetArgsError((PyObject *) self, "reset", args);
}
#if U_ICU_VERSION_HEX >= VERSION_HEX(70, 0, 0)
static PyObject *t_unicodesetiterator_skipToStrings(t_unicodesetiterator *self)
{
self->object->skipToStrings();
Py_RETURN_SELF();
}
#endif
static PyObject *t_unicodesetiterator_iter(t_unicodesetiterator *self)
{
Py_RETURN_SELF();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment