本文整理汇总了C++中CPlugin::GetScriptableObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CPlugin::GetScriptableObject方法的具体用法?C++ CPlugin::GetScriptableObject怎么用?C++ CPlugin::GetScriptableObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPlugin
的用法示例。
在下文中一共展示了CPlugin::GetScriptableObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
// ==============================
// ! Scriptability related code !
// ==============================
//
// here the plugin is asked by Mozilla to tell if it is scriptable
// we should return a valid interface id and a pointer to
// nsScriptablePeer interface which we should have implemented
// and which should be defined in the corressponding *.xpt file
// in the bin/components folder
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
if(instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
NPError rv = NPERR_NO_ERROR;
if(instance == NULL)
return NPERR_GENERIC_ERROR;
CPlugin * plugin = (CPlugin *)instance->pdata;
if(plugin == NULL)
return NPERR_GENERIC_ERROR;
switch (variable) {
case NPPVpluginNameString:
*((char **)value) = PLUGIN_NAME;
break;
case NPPVpluginDescriptionString:
*((char **)value) = PLUGIN_DESCRIPTION;
break;
case NPPVpluginScriptableNPObject:
*(NPObject **)value = plugin->GetScriptableObject();
break;
default:
rv = NPERR_GENERIC_ERROR;
}
return rv;
}
示例2:
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
if(instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
NPError rv = NPERR_NO_ERROR;
if(instance == NULL)
return NPERR_GENERIC_ERROR;
CPlugin * plugin = (CPlugin *)instance->pdata;
if(plugin == NULL)
return NPERR_GENERIC_ERROR;
switch (variable) {
case NPPVpluginNameString:
*((char **)value) = NPPVPLUGINNAMESTRING;
break;
case NPPVpluginDescriptionString:
*((char **)value) = NPPVPLUGINDESCRIPTIONSTRING;
break;
// Here we indicate that the plugin is scriptable. See this page for details:
// https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/Scripting_plugins
case NPPVpluginScriptableNPObject:
*(NPObject **)value = plugin->GetScriptableObject();
break;
default:
rv = plugin->GetValue(variable, value);
}
return rv;
}
示例3:
NPObject *NPP_GetScriptableInstance(NPP instance)
{
if(!instance)
return 0;
NPObject *npobj = 0;
CPlugin * pPlugin = (CPlugin *)instance->pdata;
if (!pPlugin)
npobj = pPlugin->GetScriptableObject();
return npobj;
}
示例4:
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
if(instance == NULL)
{
return NPERR_INVALID_INSTANCE_ERROR;
}
NPError rv = NPERR_NO_ERROR;
if(instance == NULL)
{
return NPERR_GENERIC_ERROR;
}
CPlugin * plugin = (CPlugin *)instance->pdata;
if(plugin == NULL)
{
return NPERR_GENERIC_ERROR;
}
switch (variable)
{
case NPPVpluginNameString:
{
*((char **)value) = "NPRuntimeTest";
break;
}
case NPPVpluginDescriptionString:
{
*((char **)value) = "NPRuntime scriptability API test plugin";
break;
}
case NPPVpluginScriptableNPObject:
{
*(NPObject **)value = plugin->GetScriptableObject();
break;
}
default:
{
rv = NPERR_GENERIC_ERROR;
}
}
return rv;
}
示例5: NPP_GetValue
// ==============================
// ! Scriptability related code !
// ==============================
//
// here the plugin is asked by Mozilla to tell if it is scriptable
// we should return a valid interface id and a pointer to
// nsScriptablePeer interface which we should have implemented
// and which should be defined in the corressponding *.xpt file
// in the bin/components folder
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
NPError rv = NPERR_NO_ERROR;
if (variable == NPPVpluginScriptableNPObject) {
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
CPlugin *plugin = (CPlugin *) instance->pdata;
if (plugin == NULL)
return NPERR_GENERIC_ERROR;
*(NPObject **) value = plugin->GetScriptableObject();
} else {
rv = PluginGetValue(variable, value);
}
return rv;
}
示例6: switch
// ==============================
// ! Scriptability related code !
// ==============================
//
// here the plugin is asked by Mozilla to tell if it is scriptable
// we should return a valid interface id and a pointer to
// nsScriptablePeer interface which we should have implemented
// and which should be defined in the corressponding *.xpt file
// in the bin/components folder
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
if(instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
NPError rv = NPERR_NO_ERROR;
if(instance == NULL)
return NPERR_GENERIC_ERROR;
CPlugin * plugin = (CPlugin *)instance->pdata;
if(plugin == NULL)
return NPERR_GENERIC_ERROR;
switch (variable)
{
case NPPVpluginWindowBool:
*((PRBool *)value) = PR_TRUE;
break;
case NPPVpluginNameString:
*((char **)value) = "Boilerplate Plugin";
break;
case NPPVpluginDescriptionString:
*((char **)value) = "Boilerplate web plugin";
break;
case NPPVpluginScriptableNPObject:
if (!plugin->isInitialized())
{
return NPERR_GENERIC_ERROR;
}
*((NPObject **)value) = plugin->GetScriptableObject();
break;
default:
rv = NPERR_GENERIC_ERROR;
break;
}
return rv;
}