static PyObject *t_regexmatcher_split(t_regexmatcher *self, PyObject *args) { UnicodeString *u, _u; int capacity, count; if (!parseArgs(args, "Si", &u, &_u, &capacity)) { if (capacity < 32) { UnicodeString array[31]; PyObject *tuple; STATUS_CALL(count = self->object->split(*u, array, capacity, status)); tuple = PyTuple_New(count); for (int i = 0; i < count; i++) PyTuple_SET_ITEM(tuple, i, PyUnicode_FromUnicodeString(&array[i])); return tuple; } else { class finalizer { public: UnicodeString *array; finalizer(int size) { array = new UnicodeString[size]; } ~finalizer() { delete[] array; } }; finalizer finally(capacity); PyObject *tuple; if (!finally.array) return PyErr_NoMemory(); STATUS_CALL(count = self->object->split(*u, finally.array, capacity, status)); tuple = PyTuple_New(count); for (int i = 0; i < count; i++) PyTuple_SET_ITEM(tuple, i, PyUnicode_FromUnicodeString(&finally.array[i])); return tuple; } } return PyErr_SetArgsError((PyObject *) self, "split", args); }
static PyObject *t_regexmatcher_reset(t_regexmatcher *self, PyObject *args) { int32_t index; UnicodeString *u, _u; switch (PyTuple_Size(args)) { case 0: self->object->reset(); Py_RETURN_SELF(); case 1: if (!parseArgs(args, "i", &index)) { STATUS_CALL(self->object->reset(index, status)); Py_RETURN_SELF(); } if (!parseArgs(args, "S", &u, &_u)) { self->object->reset(*u); Py_RETURN_SELF(); } break; } return PyErr_SetArgsError((PyObject *) self, "reset", args); }
static PyObject *t_regexpattern_matcher(t_regexpattern *self, PyObject *args) { UnicodeString *u; RegexMatcher *matcher; PyObject *input = NULL; switch (PyTuple_Size(args)) { case 0: STATUS_CALL(matcher = self->object->matcher(status)); return wrap_RegexMatcher(matcher, (PyObject *) self, input); case 1: if (!parseArgs(args, "W", &u, &input)) { UErrorCode status = U_ZERO_ERROR; matcher = self->object->matcher(*u, status); if (U_FAILURE(status)) { Py_XDECREF(input); return ICUException(status).reportError(); } return wrap_RegexMatcher(matcher, (PyObject *) self, input); } break; } return PyErr_SetArgsError((PyObject *) self, "matcher", args); }
static PyObject *t_resourcebundle_getInt(t_resourcebundle *self) { int n; STATUS_CALL(n = self->object->getInt(status)); return PyInt_FromLong(n); }
static PyObject *t_searchiterator_nextMatch(t_searchiterator *self) { int32_t next; STATUS_CALL(next = self->object->next(status)); return PyInt_FromLong(next); }
static PyObject *t_searchiterator_last(t_searchiterator *self) { int32_t last; STATUS_CALL(last = self->object->last(status)); return PyInt_FromLong(last); }
static PyObject *t_locale_createKeywords(t_locale *self) { StringEnumeration *se; STATUS_CALL(se = self->object->createKeywords(status)); return wrap_StringEnumeration(se, T_OWNED); }
static PyObject *t_localedata_getMeasurementSystem(t_localedata *self) { UMeasurementSystem ms; STATUS_CALL(ms = ulocdata_getMeasurementSystem(self->locale_id, &status)); return PyInt_FromLong(ms); }
static PyObject *t_localedata_getPaperSize(t_localedata *self) { int32_t width, height; STATUS_CALL(ulocdata_getPaperSize(self->locale_id, &width, &height, &status)); return Py_BuildValue("ii", width, height); }
static PyObject *t_searchiterator_setText(t_searchiterator *self, PyObject *arg) { UnicodeString *u; CharacterIterator *chars; if (!parseArg(arg, "W", &u, &self->text)) { STATUS_CALL(self->object->setText(*u, status)); /* ref'd */ Py_RETURN_NONE; } else if (!parseArg(arg, "P", TYPE_ID(CharacterIterator), &chars)) { STATUS_CALL(self->object->setText(*chars, status)); /* copied */ Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "setText", arg); }
static PyObject *t_resourcebundle_getBinary(t_resourcebundle *self) { int32_t len; const uint8_t *data; STATUS_CALL(data = self->object->getBinary(len, status)); return PyString_FromStringAndSize((const char *) data, len); }
static PyObject *t_regexmatcher_end(t_regexmatcher *self, PyObject *args) { int32_t index, groupNum; switch (PyTuple_Size(args)) { case 0: STATUS_CALL(index = self->object->end(status)); return PyInt_FromLong(index); case 1: if (!parseArgs(args, "i", &groupNum)) { STATUS_CALL(index = self->object->end(groupNum, status)); return PyInt_FromLong(index); } break; } return PyErr_SetArgsError((PyObject *) self, "end", args); }
static PyObject *t_regexmatcher_lookingAt(t_regexmatcher *self, PyObject *args) { int32_t startIndex; UBool b; switch (PyTuple_Size(args)) { case 0: STATUS_CALL(b = self->object->lookingAt(status)); Py_RETURN_BOOL(b); case 1: if (!parseArgs(args, "i", &startIndex)) { STATUS_CALL(b = self->object->lookingAt(startIndex, status)); Py_RETURN_BOOL(b); } } return PyErr_SetArgsError((PyObject *) self, "matches", args); }
static PyObject *t_locale_setDefault(PyTypeObject *type, PyObject *args) { Locale *locale; switch (PyTuple_Size(args)) { case 0: STATUS_CALL(Locale::setDefault(NULL, status)); Py_RETURN_NONE; case 1: if (!parseArgs(args, "P", TYPE_CLASSID(Locale), &locale)) { STATUS_CALL(Locale::setDefault(*locale, status)); /* transient */ Py_RETURN_NONE; } break; } return PyErr_SetArgsError(type, "setDefault", args); }
static PyObject *t_localedata_getLocaleSeparator(t_localedata *self) { UChar buffer[256]; int size; STATUS_CALL(size = ulocdata_getLocaleSeparator(self->object, buffer, 255, &status)); return PyUnicode_FromUnicodeString(buffer, size); }
static PyObject *t_resourcebundle_getString(t_resourcebundle *self, PyObject *args) { UnicodeString *u, _u; switch (PyTuple_Size(args)) { case 0: STATUS_CALL(_u = self->object->getString(status)); return PyUnicode_FromUnicodeString(&_u); case 1: if (!parseArgs(args, "U", &u)) { STATUS_CALL(u->setTo(self->object->getString(status))); Py_RETURN_ARG(args, 0); } break; } return PyErr_SetArgsError((PyObject *) self, "getString", args); }
static PyObject *t_searchiterator_setBreakIterator(t_searchiterator *self, PyObject *arg) { BreakIterator *iterator; if (arg == Py_None) { STATUS_CALL(self->object->setBreakIterator(NULL, status)); Py_XDECREF(self->iterator); self->iterator = NULL; Py_RETURN_NONE; } if (!parseArg(arg, "p", TYPE_ID(BreakIterator), &iterator, &self->iterator)) { /* ref'd */ STATUS_CALL(self->object->setBreakIterator(iterator, status)); Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "setBreakIterator", arg); }
static PyObject *t_regexmatcher_group(t_regexmatcher *self, PyObject *args) { UnicodeString u; int32_t groupNum; switch (PyTuple_Size(args)) { case 0: STATUS_CALL(u = self->object->group(status)); return PyUnicode_FromUnicodeString(&u); case 1: if (!parseArgs(args, "i", &groupNum)) { STATUS_CALL(u = self->object->group(groupNum, status)); return PyUnicode_FromUnicodeString(&u); } break; } return PyErr_SetArgsError((PyObject *) self, "group", args); }
static PyObject *t_breakiterator_getLocale(t_breakiterator *self, PyObject *args) { ULocDataLocaleType type; Locale locale; switch (PyTuple_Size(args)) { case 0: STATUS_CALL(locale = self->object->getLocale(ULOC_VALID_LOCALE, status)); return wrap_Locale(locale); case 1: if (!parseArgs(args, "i", &type)) { STATUS_CALL(locale = self->object->getLocale(type, status)); return wrap_Locale(locale); } break; } return PyErr_SetArgsError((PyObject *) self, "getLocale", args); }
static PyObject *t_breakiterator_getLocaleID(t_breakiterator *self, PyObject *args) { ULocDataLocaleType type; const char *id; switch (PyTuple_Size(args)) { case 0: STATUS_CALL(id = self->object->getLocaleID(ULOC_VALID_LOCALE, status)); return PyString_FromString(id); case 1: if (!parseArgs(args, "i", &type)) { STATUS_CALL(id = self->object->getLocaleID(type, status)); return PyString_FromString(id); } break; } return PyErr_SetArgsError((PyObject *) self, "getLocaleID", args); }
static PyObject *t_collationelementiterator_setOffset(t_collationelementiterator *self, PyObject *arg) { int offset; if (!parseArg(arg, "i", &offset)) { STATUS_CALL(self->object->setOffset(offset, status)); Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "setOffset", arg); }
static PyObject *t_collationelementiterator_setText(t_collationelementiterator *self, PyObject *arg) { UnicodeString *u, _u; if (!parseArg(arg, "S", &u, &_u)) { STATUS_CALL(self->object->setText(*u, status)); /* copied */ Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "setText", arg); }
static PyObject *t_locale_setKeywordValue(t_locale *self, PyObject *args) { charsArg name, value; if (!parseArgs(args, "nn", &name, &value)) { STATUS_CALL(self->object->setKeywordValue(name, value, status)); Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "setKeywordValue", args); }
static PyObject *t_locale_removeKeywordValue(t_locale *self, PyObject *arg) { charsArg name; if (!parseArg(arg, "n", &name)) { STATUS_CALL(self->object->setKeywordValue(name, "", status)); Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "removeKeywordValue", arg); }
static PyObject *t_regexmatcher_replaceAll(t_regexmatcher *self, PyObject *arg) { UnicodeString *u, _u, result; if (!parseArg(arg, "S", &u, &_u)) { STATUS_CALL(result = self->object->replaceAll(*u, status)); return PyUnicode_FromUnicodeString(&result); } return PyErr_SetArgsError((PyObject *) self, "replaceAll", arg); }
static PyObject *t_stringsearch_setPattern(t_stringsearch *self, PyObject *arg) { UnicodeString *u, _u; if (!parseArg(arg, "S", &u, &_u)) { STATUS_CALL(self->object->setPattern(*u, status)); /* copied */ Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "setPattern", arg); }
static PyObject *t_regexmatcher_region(t_regexmatcher *self, PyObject *args) { int32_t start, end; if (!parseArgs(args, "ii", &start, &end)) { STATUS_CALL(self->object->region(start, end, status)); Py_RETURN_SELF(); } return PyErr_SetArgsError((PyObject *) self, "region", args); }
static PyObject *t_regexmatcher_setStackLimit(t_regexmatcher *self, PyObject *arg) { int32_t limit; if (!parseArg(arg, "i", &limit)) { STATUS_CALL(self->object->setStackLimit(limit, status)); Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "setStackLimit", arg); }
static PyObject *t_searchiterator_preceding(t_searchiterator *self, PyObject *arg) { int32_t position, preceding; if (!parseArg(arg, "i", &position)) { STATUS_CALL(preceding = self->object->preceding(position, status)); return PyInt_FromLong(preceding); } return PyErr_SetArgsError((PyObject *) self, "preceding", arg); }
static PyObject *t_canonicaliterator_setSource(t_canonicaliterator *self, PyObject *arg) { UnicodeString *u, _u; if (!parseArg(arg, "S", &u, &_u)) { STATUS_CALL(self->object->setSource(*u, status)); /* transient */ Py_RETURN_NONE; } return PyErr_SetArgsError((PyObject *) self, "setSource", arg); }