本文整理汇总了C++中JPType::asHostObject方法的典型用法代码示例。如果您正苦于以下问题:C++ JPType::asHostObject方法的具体用法?C++ JPType::asHostObject怎么用?C++ JPType::asHostObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPType
的用法示例。
在下文中一共展示了JPType::asHostObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getInstanceValue
HostRef* JPObjectType::getInstanceValue(jobject c, jfieldID fid, JPTypeName& tgtType)
{
TRACE_IN("JPObjectType::getInstanceValue");
JPCleaner cleaner;
jobject r = JPEnv::getJava()->GetObjectField(c, fid);
cleaner.addLocal(r);
jvalue v;
v.l = r;
JPTypeName name = JPJni::getClassName(v.l);
JPType* type = JPTypeManager::getType(name);
return type->asHostObject(v);
TRACE_OUT;
}
示例2: invokeStatic
HostRef* JPObjectType::invokeStatic(jclass claz, jmethodID mth, jvalue* val)
{
TRACE_IN("JPObjectType::invokeStatic");
JPCleaner cleaner;
jobject res = JPEnv::getJava()->CallStaticObjectMethodA(claz, mth, val);
cleaner.addLocal(res);
jvalue v;
v.l = res;
JPTypeName name = JPJni::getClassName(v.l);
JPType* type = JPTypeManager::getType(name);
return type->asHostObject(v);
TRACE_OUT;
}
示例3: asHostObject
HostRef* JPClass::asHostObject(jvalue obj)
{
TRACE_IN("JPClass::asPyObject");
if (obj.l == NULL)
{
return JPEnv::getHost()->getNone();
}
JPTypeName name = JPJni::getClassName(obj.l);
if (name.getType() ==JPTypeName::_array)
{
JPType* arrayType = JPTypeManager::getType(name);
return arrayType->asHostObject(obj);
}
return JPEnv::getHost()->newObject(new JPObject(name, obj.l));
TRACE_OUT;
}
示例4: invoke
HostRef* JPObjectType::invoke(jobject claz, jclass clazz, jmethodID mth, jvalue* val)
{
TRACE_IN("JPObjectType::invoke");
JPCleaner cleaner;
jobject res = JPEnv::getJava()->CallNonvirtualObjectMethodA(claz, clazz, mth, val);
cleaner.addLocal(res);
jvalue v;
v.l = res;
JPTypeName name = JPJni::getClassName(v.l);
JPType* type = JPTypeManager::getType(name);
HostRef* ref = type->asHostObject(v);
TRACE1("Successfulyl converted to host reference");
return ref;
TRACE_OUT;
}
示例5: getArrayItem
HostRef* JPObjectType::getArrayItem(jarray a, int ndx)
{
TRACE_IN("JPObjectType::getArrayItem");
jobjectArray array = (jobjectArray)a;
JPCleaner cleaner;
jobject obj = JPEnv::getJava()->GetObjectArrayElement(array, ndx);
cleaner.addLocal(obj);
if (obj == NULL)
{
return JPEnv::getHost()->getNone();
}
jvalue v;
v.l = obj;
JPTypeName name = JPJni::getClassName(v.l);
JPType* t = JPTypeManager::getType(name);
return t->asHostObject(v);
TRACE_OUT;
}
示例6:
vector<HostRef*> JPObjectType::getArrayRange(jarray a, int start, int length)
{
jobjectArray array = (jobjectArray)a;
JPCleaner cleaner;
vector<HostRef*> res;
jvalue v;
for (int i = 0; i < length; i++)
{
v.l = JPEnv::getJava()->GetObjectArrayElement(array, i+start);
cleaner.addLocal(v.l);
JPTypeName name = JPJni::getClassName(v.l);
JPType* t = JPTypeManager::getType(name);
HostRef* pv = t->asHostObject(v);
res.push_back(pv);
}
return res;
}