本文整理汇总了C++中JPType::isObjectType方法的典型用法代码示例。如果您正苦于以下问题:C++ JPType::isObjectType方法的具体用法?C++ JPType::isObjectType怎么用?C++ JPType::isObjectType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPType
的用法示例。
在下文中一共展示了JPType::isObjectType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertToJValue
PyObject* convertToJValue(PyObject* self, PyObject* arg)
{
try {
char* tname;
PyObject* value;
JPyArg::parseTuple(arg, "sO", &tname, &value);
JPTypeName name = JPTypeName::fromSimple(tname);
JPType* type = JPTypeManager::getType(name);
HostRef ref(value);
jvalue v = type->convertToJava(&ref);
jvalue* pv = new jvalue();
*pv = v;
PyObject* res;
if (type->isObjectType())
{
res = JPyCObject::fromVoidAndDesc((void*)pv, (void*)"object jvalue", PythonHostEnvironment::deleteObjectJValueDestructor);
}
else
{
res = JPyCObject::fromVoidAndDesc((void*)pv, (void*)"jvalue", PythonHostEnvironment::deleteJValueDestructor);
}
return res;
}
PY_STANDARD_CATCH
return NULL;
}
示例2: invokeConstructor
JPObject* JPMethodOverload::invokeConstructor(jclass claz, vector<HostRef*>& arg)
{
TRACE_IN("JPMethodOverload::invokeConstructor");
size_t len = arg.size();
JPCleaner cleaner;
JPMallocCleaner<jvalue> v(len);
for (unsigned int i = 0; i < len; i++)
{
HostRef* obj = arg[i];
// TODO the following can easily be optimized ... or at least cached
JPType* t = JPTypeManager::getType(m_Arguments[i]);
v[i] = t->convertToJava(obj);
if (t->isObjectType())
{
cleaner.addLocal(v[i].l);
}
}
jvalue val;
val.l = JPEnv::getJava()->NewObjectA(claz, m_MethodID, v.borrow());
cleaner.addLocal(val.l);
TRACE1("Object created");
JPTypeName name = JPJni::getName(claz);
return new JPObject(name, val.l);
TRACE_OUT;
}