当前位置: 首页>>代码示例>>C++>>正文


C++ CPlugin::GetScriptableObject方法代码示例

本文整理汇总了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;
}
开发者ID:BGCX261,项目名称:zhscript-svn-to-git,代码行数:39,代码来源:npp_gate.cpp

示例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;
}
开发者ID:jiaofeng,项目名称:Fire-IE,代码行数:33,代码来源:npp_gate.cpp

示例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;
}
开发者ID:BGCX261,项目名称:zhscript-svn-to-git,代码行数:12,代码来源:npp_gate.cpp

示例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;
}
开发者ID:pluginyog,项目名称:CardPlugin4Chrome,代码行数:49,代码来源:npp_gate.cpp

示例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;
}
开发者ID:bjsnider,项目名称:gecko-mediaplayer,代码行数:26,代码来源:npp_gate.cpp

示例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;
}
开发者ID:bundgaard,项目名称:BoilerplateNp,代码行数:55,代码来源:npp_gate.cpp


注:本文中的CPlugin::GetScriptableObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。