本文整理汇总了C++中MetadataNode::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ MetadataNode::GetName方法的具体用法?C++ MetadataNode::GetName怎么用?C++ MetadataNode::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataNode
的用法示例。
在下文中一共展示了MetadataNode::GetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CallJavaMethod
void NativeScriptRuntime::CallJavaMethod(const Local<Object>& caller, const string& className, const string& methodName, MetadataEntry *entry, bool isStatic, bool isSuper, const v8::FunctionCallbackInfo<v8::Value>& args)
{
SET_PROFILER_FRAME();
JEnv env;
jclass clazz;
jmethodID mid;
string *sig = nullptr;
string *returnType = nullptr;
auto retType = MethodReturnType::Unknown;
MethodCache::CacheMethodInfo mi;
if ((entry != nullptr) && entry->isResolved)
{
isStatic = entry->isStatic;
if (entry->memberId == nullptr)
{
clazz = env.FindClass(className);
if (clazz == nullptr)
{
MetadataNode* callerNode = MetadataNode::GetNodeFromHandle(caller);
const string callerClassName = callerNode->GetName();
DEBUG_WRITE("Cannot resolve class: %s while calling method: %s callerClassName: %s", className.c_str(), methodName.c_str(), callerClassName.c_str());
clazz = env.FindClass(callerClassName);
if (clazz == nullptr)
{
//todo: plamen5kov: throw exception here
DEBUG_WRITE("Cannot resolve caller's class name: %s", callerClassName.c_str());
return;
}
entry->memberId = isStatic ?
env.GetStaticMethodID(clazz, methodName, entry->sig) :
env.GetMethodID(clazz, methodName, entry->sig);
if (entry->memberId == nullptr)
{
//todo: plamen5kov: throw exception here
DEBUG_WRITE("Cannot resolve a method %s on caller class: %s", methodName.c_str(), callerClassName.c_str());
return;
}
}
else
{
entry->memberId = isStatic ?
env.GetStaticMethodID(clazz, methodName, entry->sig) :
env.GetMethodID(clazz, methodName, entry->sig);
if (entry->memberId == nullptr)
{
//todo: plamen5kov: throw exception here
DEBUG_WRITE("Cannot resolve a method %s on class: %s", methodName.c_str(), className.c_str());
return;
}
}
entry->clazz = clazz;
}
mid = reinterpret_cast<jmethodID>(entry->memberId);
clazz = entry->clazz;
sig = &entry->sig;
returnType = &entry->returnType;
retType = entry->retType;
}
else
{
DEBUG_WRITE("Resolving method: %s on className %s", methodName.c_str(), className.c_str());
clazz = env.FindClass(className);
if (clazz != nullptr)
{
mi = MethodCache::ResolveMethodSignature(className, methodName, args, isStatic);
if (mi.mid == nullptr)
{
DEBUG_WRITE("Cannot resolve class=%s, method=%s, isStatic=%d, isSuper=%d", className.c_str(), methodName.c_str(), isStatic, isSuper);
return;
}
}
else
{
MetadataNode* callerNode = MetadataNode::GetNodeFromHandle(caller);
const string callerClassName = callerNode->GetName();
DEBUG_WRITE("Resolving method on caller class: %s.%s on className %s", callerClassName.c_str(), methodName.c_str(), className.c_str());
mi = MethodCache::ResolveMethodSignature(callerClassName, methodName, args, isStatic);
if (mi.mid == nullptr)
{
DEBUG_WRITE("Cannot resolve class=%s, method=%s, isStatic=%d, isSuper=%d, callerClass=%s", className.c_str(), methodName.c_str(), isStatic, isSuper, callerClassName.c_str());
return;
}
}
clazz = mi.clazz;
mid = mi.mid;
sig = &mi.signature;
returnType = &mi.returnType;
retType = mi.retType;
}
//.........这里部分代码省略.........
示例2: CallJavaMethod
void NativeScriptRuntime::CallJavaMethod(const Handle<Object>& caller, const string& className, const string& methodName, MetadataEntry *entry, bool isStatic, bool isSuper, const v8::FunctionCallbackInfo<v8::Value>& args)
{
SET_PROFILER_FRAME();
JEnv env;
jclass clazz;
jmethodID mid;
string sig;
if ((entry != nullptr) && entry->isResolved)
{
isStatic = entry->isStatic;
if (entry->memberId == nullptr)
{
entry->clazz = env.FindClass(className);
if (entry->clazz == nullptr)
{
MetadataNode* callerNode = MetadataNode::GetNodeFromHandle(caller);
const string callerClassName = callerNode->GetName();
DEBUG_WRITE("Cannot resolve class: %s while calling method: %s callerClassName: %s", className.c_str(), methodName.c_str(), callerClassName.c_str());
clazz = env.FindClass(callerClassName);
if (clazz == nullptr)
{
DEBUG_WRITE("Cannot resolve caller's class name: %s", callerClassName.c_str());
return;
}
mid = isStatic ?
env.GetStaticMethodID(clazz, methodName, entry->sig) :
env.GetMethodID(clazz, methodName, entry->sig);
if (mid == nullptr)
{
DEBUG_WRITE("Cannot resolve a method %s on caller class: %s", methodName.c_str(), callerClassName.c_str());
return;
}
}
else
{
entry->memberId = isStatic ?
env.GetStaticMethodID(entry->clazz, methodName, entry->sig) :
env.GetMethodID(entry->clazz, methodName, entry->sig);
if (entry->memberId == nullptr)
{
DEBUG_WRITE("Cannot resolve a method %s on class: %s", methodName.c_str(), className.c_str());
return;
}
}
}
if (entry->clazz != nullptr)
{
clazz = entry->clazz;
mid = reinterpret_cast<jmethodID>(entry->memberId);
}
sig = entry->sig;
}
else
{
DEBUG_WRITE("Resolving method: %s on className %s", methodName.c_str(), className.c_str());
MethodCache::CacheMethodInfo mi;
clazz = env.FindClass(className);
if (clazz != nullptr)
{
mi = MethodCache::ResolveMethodSignature(className, methodName, args, isStatic);
if (mi.mid == nullptr)
{
DEBUG_WRITE("Cannot resolve class=%s, method=%s, isStatic=%d, isSuper=%d", className.c_str(), methodName.c_str(), isStatic, isSuper);
return;
}
}
else
{
MetadataNode* callerNode = MetadataNode::GetNodeFromHandle(caller);
const string callerClassName = callerNode->GetName();
DEBUG_WRITE("Resolving method on caller class: %s.%s on className %s", callerClassName.c_str(), methodName.c_str(), className.c_str());
mi = MethodCache::ResolveMethodSignature(callerClassName, methodName, args, isStatic);
if (mi.mid == nullptr)
{
DEBUG_WRITE("Cannot resolve class=%s, method=%s, isStatic=%d, isSuper=%d, callerClass=%s", className.c_str(), methodName.c_str(), isStatic, isSuper, callerClassName.c_str());
return;
}
}
clazz = mi.clazz;
mid = mi.mid;
sig = mi.signature;
}
//.........这里部分代码省略.........