本文整理汇总了C++中PluginProtocol::setPluginName方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginProtocol::setPluginName方法的具体用法?C++ PluginProtocol::setPluginName怎么用?C++ PluginProtocol::setPluginName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginProtocol
的用法示例。
在下文中一共展示了PluginProtocol::setPluginName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPlugin
/** create the plugin by name */
PluginProtocol* PluginFactory::createPlugin(const char* name)
{
PluginProtocol* pRet = NULL;
do
{
if (name == NULL || strlen(name) == 0) break;
std::string jClassName = ANDROID_PLUGIN_PACKAGE_PREFIX;
jClassName.append(name);
PluginUtils::outputLog("PluginFactory", "Java class name of plugin %s is : %s", name, jClassName.c_str());
PluginJniMethodInfo t;
if (! PluginJniHelper::getStaticMethodInfo(t
, "org/cocos2dx/plugin/PluginWrapper"
, "initPlugin"
, "(Ljava/lang/String;)Ljava/lang/Object;"))
{
PluginUtils::outputLog("PluginFactory", "Can't find method initPlugin in class org.cocos2dx.plugin.PluginWrapper");
break;
}
jstring clsName = t.env->NewStringUTF(jClassName.c_str());
jobject jObj = t.env->CallStaticObjectMethod(t.classID, t.methodID, clsName);
t.env->DeleteLocalRef(clsName);
t.env->DeleteLocalRef(t.classID);
if (jObj == NULL)
{
PluginUtils::outputLog("PluginFactory", "Can't find java class %s", jClassName.c_str());
break;
}
if (! PluginJniHelper::getStaticMethodInfo(t
, "org/cocos2dx/plugin/PluginWrapper"
, "getPluginType"
, "(Ljava/lang/Object;)I"))
{
PluginUtils::outputLog("PluginFactory", "Can't find method getPluginType in class org.cocos2dx.plugin.PluginWrapper");
break;
}
int curType = t.env->CallStaticIntMethod(t.classID, t.methodID, jObj);
t.env->DeleteLocalRef(t.classID);
PluginUtils::outputLog("PluginFactory", "The type of plugin %s is : %d", name, curType);
switch (curType)
{
case kPluginAds:
pRet = new ProtocolAds();
break;
case kPluginAnalytics:
pRet = new ProtocolAnalytics();
break;
case kPluginIAP:
pRet = new ProtocolIAP();
break;
case kPluginShare:
pRet = new ProtocolShare();
break;
case kPluginUser:
pRet = new ProtocolUser();
break;
case kPluginSocial:
pRet = new ProtocolSocial();
break;
case kPluginData:
pRet = new ProtocolData();
break;
case kPluginBaaS:
pRet = new ProtocolBaaS();
break;
default:
break;
}
if (pRet != NULL)
{
pRet->setPluginName(name);
PluginUtils::initJavaPlugin(pRet, jObj, jClassName.c_str());
}
} while(0);
return pRet;
}