本文整理汇总了C++中PythonObject::check方法的典型用法代码示例。如果您正苦于以下问题:C++ PythonObject::check方法的具体用法?C++ PythonObject::check怎么用?C++ PythonObject::check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PythonObject
的用法示例。
在下文中一共展示了PythonObject::check方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setattro
DECLARE_EXPORT int ResourceSkill::setattro(const Attribute& attr, const PythonObject& field)
{
if (attr.isA(Tags::tag_resource))
{
if (!field.check(Resource::metadata))
{
PyErr_SetString(PythonDataException, "resourceskill resource must be of type resource");
return -1;
}
Resource* y = static_cast<Resource*>(static_cast<PyObject*>(field));
setResource(y);
}
else if (attr.isA(Tags::tag_skill))
{
if (!field.check(Skill::metadata))
{
PyErr_SetString(PythonDataException, "resourceskill skill must be of type skill");
return -1;
}
Skill* y = static_cast<Skill*>(static_cast<PyObject*>(field));
setSkill(y);
}
else if (attr.isA(Tags::tag_priority))
setPriority(field.getInt());
else if (attr.isA(Tags::tag_effective_end))
setEffectiveEnd(field.getDate());
else if (attr.isA(Tags::tag_effective_start))
setEffectiveStart(field.getDate());
else
return -1;
return 0;
}
示例2: setattro
DECLARE_EXPORT int Item::setattro(const Attribute& attr, const PythonObject& field)
{
if (attr.isA(Tags::tag_name))
setName(field.getString());
else if (attr.isA(Tags::tag_description))
setDescription(field.getString());
else if (attr.isA(Tags::tag_category))
setCategory(field.getString());
else if (attr.isA(Tags::tag_subcategory))
setSubCategory(field.getString());
else if (attr.isA(Tags::tag_price))
setPrice(field.getDouble());
else if (attr.isA(Tags::tag_owner))
{
if (!field.check(Item::metadata))
{
PyErr_SetString(PythonDataException, "item owner must be of type item");
return -1;
}
Item* y = static_cast<Item*>(static_cast<PyObject*>(field));
setOwner(y);
}
else if (attr.isA(Tags::tag_operation))
{
if (!field.check(Operation::metadata))
{
PyErr_SetString(PythonDataException, "item operation must be of type operation");
return -1;
}
Operation* y = static_cast<Operation*>(static_cast<PyObject*>(field));
setOperation(y);
}
else if (attr.isA(Tags::tag_hidden))
setHidden(field.getBool());
else
return -1;
return 0;
}
示例3: setattro
DECLARE_EXPORT int Location::setattro(const Attribute& attr, const PythonObject& field)
{
if (attr.isA(Tags::tag_name))
setName(field.getString());
else if (attr.isA(Tags::tag_description))
setDescription(field.getString());
else if (attr.isA(Tags::tag_category))
setCategory(field.getString());
else if (attr.isA(Tags::tag_subcategory))
setSubCategory(field.getString());
else if (attr.isA(Tags::tag_owner))
{
if (!field.check(Location::metadata))
{
PyErr_SetString(PythonDataException, "location owner must be of type location");
return -1;
}
Location* y = static_cast<Location*>(static_cast<PyObject*>(field));
setOwner(y);
}
else if (attr.isA(Tags::tag_available))
{
if (!field.check(CalendarDouble::metadata))
{
PyErr_SetString(PythonDataException, "location availability must be of type double calendar");
return -1;
}
CalendarDouble* y = static_cast<CalendarDouble*>(static_cast<PyObject*>(field));
setAvailable(y);
}
else if (attr.isA(Tags::tag_hidden))
setHidden(field.getBool());
else
return -1;
return 0;
}