本文整理汇总了C++中PyErr_SetArgsError函数的典型用法代码示例。如果您正苦于以下问题:C++ PyErr_SetArgsError函数的具体用法?C++ PyErr_SetArgsError怎么用?C++ PyErr_SetArgsError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PyErr_SetArgsError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: t_locale_init
static int t_locale_init(t_locale *self, PyObject *args, PyObject *kwds)
{
charsArg language, country, variant;
int lcid, len;
switch (PyTuple_Size(args)) {
case 0:
self->object = new Locale();
self->flags = T_OWNED;
break;
case 1:
if (!parseArgs(args, "n", &language))
{
self->object = new Locale(language);
self->flags = T_OWNED;
break;
}
if (!parseArgs(args, "i", &lcid))
{
char code[128];
INT_STATUS_CALL(len = uloc_getLocaleForLCID(
lcid, code, sizeof(code), &status));
if (len < sizeof(code))
{
self->object = new Locale(code);
self->flags = T_OWNED;
}
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
case 2:
if (!parseArgs(args, "nn", &language, &country))
{
self->object = new Locale(language, country);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
case 3:
if (!parseArgs(args, "nnn", &language, &country, &variant))
{
self->object = new Locale(language, country, variant);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
default:
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
}
if (self->object)
return 0;
return -1;
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:60,代码来源:locale.cpp
示例2: t_regexpattern_init
static int t_regexpattern_init(t_regexpattern *self,
PyObject *args, PyObject *kwds)
{
RegexPattern *pattern;
switch (PyTuple_Size(args)) {
case 0:
self->object = new RegexPattern();
self->flags = T_OWNED;
break;
case 1:
if (!parseArgs(args, "P", TYPE_CLASSID(RegexPattern), &pattern))
{
self->object = new RegexPattern(*pattern);
self->flags = T_OWNED;
self->re = NULL;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
default:
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
}
if (self->object)
return 0;
return -1;
}
开发者ID:fish2000,项目名称:pyicu-praxa,代码行数:30,代码来源:regex.cpp
示例3: t_localedata_init
static int t_localedata_init(t_localedata *self, PyObject *args, PyObject *kwds)
{
charsArg id;
switch (PyTuple_Size(args)) {
case 1:
if (!parseArgs(args, "n", &id))
{
ULocaleData *locale_data;
INT_STATUS_CALL(locale_data = ulocdata_open(id, &status));
self->object = locale_data;
self->locale_id = strdup((const char *) id);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
default:
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
}
if (self->object)
return 0;
return -1;
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:28,代码来源:locale.cpp
示例4: switch
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);
}
开发者ID:fish2000,项目名称:pyicu-praxa,代码行数:25,代码来源:regex.cpp
示例5: switch
static PyObject *t_locale_getDisplayName(t_locale *self, PyObject *args)
{
Locale *locale;
UnicodeString *u;
UnicodeString _u;
switch (PyTuple_Size(args)) {
case 0:
self->object->getDisplayName(_u);
return PyUnicode_FromUnicodeString(&_u);
case 1:
if (!parseArgs(args, "P", TYPE_CLASSID(Locale), &locale))
{
self->object->getDisplayName(*locale, _u);
return PyUnicode_FromUnicodeString(&_u);
}
if (!parseArgs(args, "U", &u))
{
self->object->getDisplayName(*u);
Py_RETURN_ARG(args, 0);
}
break;
case 2:
if (!parseArgs(args, "PU", TYPE_CLASSID(Locale), &locale, &u))
{
self->object->getDisplayName(*locale, *u);
Py_RETURN_ARG(args, 1);
}
break;
}
return PyErr_SetArgsError((PyObject *) self, "getDisplayName", args);
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:33,代码来源:locale.cpp
示例6: switch
static PyObject *t_forwardcharacteriterator_richcmp(t_forwardcharacteriterator *self, PyObject *arg, int op)
{
int b = 0;
ForwardCharacterIterator *i;
if (!parseArg(arg, "P", TYPE_ID(ForwardCharacterIterator), &i))
{
switch (op) {
case Py_EQ:
case Py_NE:
b = *self->object == *i;
if (op == Py_EQ)
Py_RETURN_BOOL(b);
Py_RETURN_BOOL(!b);
case Py_LT:
case Py_LE:
case Py_GT:
case Py_GE:
PyErr_SetNone(PyExc_NotImplementedError);
return NULL;
}
}
return PyErr_SetArgsError((PyObject *) self, "__richcmp__", arg);
}
开发者ID:nikolamilosevic86,项目名称:SerbianComparisonExtractor,代码行数:25,代码来源:iterators.cpp
示例7: ICUException
static PyObject *t_resourcebundle_get(t_resourcebundle *self, PyObject *arg)
{
UErrorCode status = U_ZERO_ERROR;
charsArg key;
int i;
if (!parseArg(arg, "i", &i))
{
ResourceBundle rb = self->object->get(i, status);
if (U_FAILURE(status))
return ICUException(status).reportError();
return wrap_ResourceBundle(rb);
}
if (!parseArg(arg, "n", &key))
{
ResourceBundle rb = self->object->get(key, status);
if (U_FAILURE(status))
return ICUException(status).reportError();
return wrap_ResourceBundle(rb);
}
return PyErr_SetArgsError((PyObject *) self, "get", arg);
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:28,代码来源:locale.cpp
示例8: CreateFile
static PyObject *t_resourcebundle_setAppData(PyTypeObject *type,
PyObject *args)
{
charsArg packageName, path;
if (!parseArgs(args, "nf", &packageName, &path))
{
HANDLE fd = CreateFile(path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
UErrorCode status = U_ZERO_ERROR;
DWORD dwSize;
HANDLE hMap;
LPVOID data;
if (fd == INVALID_HANDLE_VALUE)
return PyErr_SetFromWindowsErrWithFilename(0, path);
dwSize = GetFileSize(fd, NULL);
if (dwSize == INVALID_FILE_SIZE)
{
PyErr_SetFromWindowsErrWithFilename(0, path);
CloseHandle(fd);
return NULL;
}
hMap = CreateFileMapping(fd, NULL, PAGE_READONLY, 0, dwSize, NULL);
if (!hMap)
{
PyErr_SetFromWindowsErrWithFilename(0, path);
CloseHandle(fd);
return NULL;
}
CloseHandle(fd);
data = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
if (!data)
{
PyErr_SetFromWindowsErrWithFilename(0, path);
CloseHandle(hMap);
return NULL;
}
CloseHandle(hMap);
udata_setAppData(packageName, data, &status);
if (U_FAILURE(status))
{
UnmapViewOfFile(data);
return ICUException(status).reportError();
}
Py_RETURN_NONE;
}
return PyErr_SetArgsError(type, "setAppData", args);
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:58,代码来源:locale.cpp
示例9: PyInt_FromLong
static PyObject *t_collationelementiterator_getMaxExpansion(t_collationelementiterator *self, PyObject *arg)
{
int i;
if (!parseArg(arg, "i", &i))
return PyInt_FromLong(self->object->getMaxExpansion(i));
return PyErr_SetArgsError((PyObject *) self, "getMaxExpansion", arg);
}
开发者ID:nikolamilosevic86,项目名称:SerbianComparisonExtractor,代码行数:9,代码来源:iterators.cpp
示例10: t_stringcharacteriterator_init
static int t_stringcharacteriterator_init(t_stringcharacteriterator *self,
PyObject *args, PyObject *kwds)
{
UnicodeString *u, _u;
int start, end, pos;
switch (PyTuple_Size(args)) {
case 1:
if (!parseArgs(args, "S", &u, &_u))
{
self->object = new StringCharacterIterator(*u);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
case 2:
if (!parseArgs(args, "Si", &u, &_u, &pos))
{
self->object = new StringCharacterIterator(*u, pos);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
case 4:
if (!parseArgs(args, "Siii", &u, &_u, &start, &end, &pos))
{
self->object = new StringCharacterIterator(*u, start, end, pos);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
default:
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
}
if (self->object)
return 0;
return -1;
}
开发者ID:nikolamilosevic86,项目名称:SerbianComparisonExtractor,代码行数:44,代码来源:iterators.cpp
示例11: t_ucharcharacteriterator_init
static int t_ucharcharacteriterator_init(t_ucharcharacteriterator *self,
PyObject *args, PyObject *kwds)
{
UnicodeString *u;
int len, start, end, pos;
switch (PyTuple_Size(args)) {
case 2:
if (!parseArgs(args, "Wi", &u, &self->text, &len))
{
self->object = new UCharCharacterIterator(u->getTerminatedBuffer(), len);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
case 3:
if (!parseArgs(args, "Wii", &u, &self->text, &len, &pos))
{
self->object = new UCharCharacterIterator(u->getTerminatedBuffer(), len, pos);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
case 5:
if (!parseArgs(args, "Wiiii", &u, &self->text, &len, &start, &end, &pos))
{
self->object = new UCharCharacterIterator(u->getTerminatedBuffer(), len, start, end, pos);
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
default:
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
}
if (self->object)
return 0;
return -1;
}
开发者ID:nikolamilosevic86,项目名称:SerbianComparisonExtractor,代码行数:44,代码来源:iterators.cpp
示例12: t_regexmatcher_init
static int t_regexmatcher_init(t_regexmatcher *self,
PyObject *args, PyObject *kwds)
{
RegexMatcher *matcher;
UnicodeString *u0, *u1;
uint32_t flags;
switch (PyTuple_Size(args)) {
case 2:
if (!parseArgs(args, "Wi", &u0, &self->re, &flags))
{
INT_STATUS_CALL(matcher = new RegexMatcher(*u0, flags, status));
self->object = matcher;
self->pattern = NULL;
self->input = NULL;
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
case 3:
if (!parseArgs(args, "WWi", &u0, &self->re, &u1, &self->input, &flags))
{
INT_STATUS_CALL(matcher = new RegexMatcher(*u0, *u1, flags,
status));
self->object = matcher;
self->pattern = NULL;
self->flags = T_OWNED;
break;
}
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
default:
PyErr_SetArgsError((PyObject *) self, "__init__", args);
return -1;
}
if (self->object)
return 0;
return -1;
}
开发者ID:fish2000,项目名称:pyicu-praxa,代码行数:42,代码来源:regex.cpp
示例13: STATUS_CALL
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);
}
开发者ID:fish2000,项目名称:pyicu-praxa,代码行数:12,代码来源:regex.cpp
示例14: ulocdata_setNoSubstitute
static PyObject *t_localedata_setNoSubstitute(t_localedata *self, PyObject *arg)
{
int setting;
if (!parseArg(arg, "b", &setting))
{
ulocdata_setNoSubstitute(self->object, setting);
Py_RETURN_NONE;
}
return PyErr_SetArgsError((PyObject *) self, "setNoSubstitute", arg);
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:12,代码来源:locale.cpp
示例15: Py_RETURN_BOOL
static PyObject *t_collationelementiterator_isIgnorable(PyTypeObject *type, PyObject *arg)
{
int i;
if (!parseArg(arg, "i", &i))
{
i = CollationElementIterator::isIgnorable(i);
Py_RETURN_BOOL(i);
}
return PyErr_SetArgsError(type, "isIgnorable", arg);
}
开发者ID:nikolamilosevic86,项目名称:SerbianComparisonExtractor,代码行数:12,代码来源:iterators.cpp
示例16: STATUS_CALL
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);
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:12,代码来源:locale.cpp
示例17: STATUS_CALL
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);
}
开发者ID:nikolamilosevic86,项目名称:SerbianComparisonExtractor,代码行数:12,代码来源:iterators.cpp
示例18: PyErr_SetArgsError
static PyObject *t_breakiterator_setText(t_breakiterator *self, PyObject *arg)
{
UnicodeString *u;
if (!parseArg(arg, "W", &u, &self->text))
{
self->object->setText(*u); /* ref'd */
Py_RETURN_NONE;
}
return PyErr_SetArgsError((PyObject *) self, "setText", arg);
}
开发者ID:nikolamilosevic86,项目名称:SerbianComparisonExtractor,代码行数:12,代码来源:iterators.cpp
示例19: STATUS_CALL
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);
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:12,代码来源:search.cpp
示例20: PyUnicode_FromUnicodeString
static PyObject *t_regexmatcher_appendTail(t_regexmatcher *self, PyObject *arg)
{
UnicodeString *u, _u, result;
if (!parseArg(arg, "S", &u, &_u))
{
result = self->object->appendTail(*u);
return PyUnicode_FromUnicodeString(&result);
}
return PyErr_SetArgsError((PyObject *) self, "appendTail", arg);
}
开发者ID:fish2000,项目名称:pyicu-praxa,代码行数:12,代码来源:regex.cpp
注:本文中的PyErr_SetArgsError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论