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


C++ IPlugin类代码示例

本文整理汇总了C++中IPlugin的典型用法代码示例。如果您正苦于以下问题:C++ IPlugin类的具体用法?C++ IPlugin怎么用?C++ IPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sm_GetFunctionByName

static cell_t sm_GetFunctionByName(IPluginContext *pContext, const cell_t *params)
{
	Handle_t hndl = static_cast<Handle_t>(params[1]);
	HandleError err;
	char *name;
	uint32_t idx;
	IPlugin *pPlugin;

	if (hndl == 0)
	{
		pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
	} else {
		pPlugin = g_PluginSys.PluginFromHandle(hndl, &err);

		if (!pPlugin)
		{
			return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", hndl, err);
		}
	}

	pContext->LocalToString(params[2], &name);

	/* Get public function index */
	if (pPlugin->GetBaseContext()->FindPublicByName(name, &idx) == SP_ERROR_NOT_FOUND)
	{
		/* Return INVALID_FUNCTION if not found */
		return -1;
	}

	/* Return function ID */
	return PublicIndexToFuncId(idx);
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:32,代码来源:smn_functions.cpp

示例2: sm_RemoveFromForward

static cell_t sm_RemoveFromForward(IPluginContext *pContext, const cell_t *params)
{
	Handle_t fwdHandle = static_cast<Handle_t>(params[1]);
	Handle_t plHandle = static_cast<Handle_t>(params[2]);
	HandleError err;
	IChangeableForward *pForward;
	IPlugin *pPlugin;

	if ((err=g_HandleSys.ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
		!= HandleError_None)
	{
		return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
	}

	if (plHandle == 0)
	{
		pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
	} else {
		pPlugin = g_PluginSys.PluginFromHandle(plHandle, &err);

		if (!pPlugin)
		{
			return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", plHandle, err);
		}
	}

	IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[3]);

	if (!pFunction)
	{
		return pContext->ThrowNativeError("Invalid function id (%X)", params[3]);
	}

	return pForward->RemoveFunction(pFunction);
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:35,代码来源:smn_functions.cpp

示例3: Q_UNUSED

bool MainWindowPlugin::initConnections(IPluginManager *APluginManager, int &AInitOrder)
{
	Q_UNUSED(AInitOrder);
	FPluginManager = APluginManager;

	IPlugin *plugin = FPluginManager->pluginInterface("IOptionsManager").value(0,NULL);
	if (plugin)
	{
		FOptionsManager = qobject_cast<IOptionsManager *>(plugin->instance());
		if (FOptionsManager)
		{
			connect(FOptionsManager->instance(), SIGNAL(profileRenamed(const QString &, const QString &)),
				SLOT(onProfileRenamed(const QString &, const QString &)));
		}
	}

	plugin = APluginManager->pluginInterface("ITrayManager").value(0,NULL);
	if (plugin)
	{
		FTrayManager = qobject_cast<ITrayManager *>(plugin->instance());
		if (FTrayManager)
		{
			connect(FTrayManager->instance(),SIGNAL(notifyActivated(int, QSystemTrayIcon::ActivationReason)),
				SLOT(onTrayNotifyActivated(int,QSystemTrayIcon::ActivationReason)));
		}
	}

	connect(Options::instance(),SIGNAL(optionsOpened()),SLOT(onOptionsOpened()));
	connect(Options::instance(),SIGNAL(optionsClosed()),SLOT(onOptionsClosed()));
	connect(Options::instance(),SIGNAL(optionsChanged(const OptionsNode &)),SLOT(onOptionsChanged(const OptionsNode &)));

	connect(FPluginManager->instance(),SIGNAL(shutdownStarted()),SLOT(onShutdownStarted()));

	return true;
}
开发者ID:Rambler-ru,项目名称:Contacts,代码行数:35,代码来源:mainwindowplugin.cpp

示例4: load

		IPlugin* load(const char* path) override
		{
			g_log_info.log("plugins") << "loading plugin " << path;
			typedef IPlugin* (*PluginCreator)(Engine&);

			auto* lib = loadLibrary(path);
			if (lib)
			{
				PluginCreator creator = (PluginCreator)getLibrarySymbol(lib, "createPlugin");
				if (creator)
				{
					IPlugin* plugin = creator(m_engine);
					if (!plugin || !plugin->create())
					{
						LUMIX_DELETE(m_engine.getAllocator(), plugin);
						ASSERT(false);
						return nullptr;
					}
					m_plugins.push(plugin);
					m_libraries.push(lib);
					m_library_loaded.invoke(lib);
					g_log_info.log("plugins") << "plugin loaded";
					return plugin;
				}
			}
			unloadLibrary(lib);
			return 0;
		}
开发者ID:zemanmar,项目名称:LumixEngine,代码行数:28,代码来源:plugin_manager.cpp

示例5: OnHookRemoved

void EntityOutputManager::CleanUpHook(omg_hooks *hook)
{
	FreeHooks.push(hook);

	OnHookRemoved();

	IPlugin *pPlugin = plsys->FindPluginByContext(hook->pf->GetParentContext()->GetContext());
	SourceHook::List<omg_hooks *> *pList = NULL;

	if (!pPlugin->GetProperty("OutputHookList", (void **)&pList, false) || !pList)
	{
		return;
	}

	SourceHook::List<omg_hooks *>::iterator p_iter = pList->begin();

	omg_hooks *pluginHook;

	while (p_iter != pList->end())
	{
		pluginHook = (omg_hooks *)*p_iter;
		if (pluginHook == hook)
		{
			p_iter = pList->erase(p_iter);
		}
		else
		{
			p_iter++;
		}
	}
}
开发者ID:dvarnai,项目名称:simillimum,代码行数:31,代码来源:output.cpp

示例6: throw

/* Destructor */
sentry::Sentry::~Sentry() throw(){

    /* Execute the pre-shutdown actions */
    IHookPoint* pre_shutdown = findHookPoint("core.pre_shutdown");
    if( ! pre_shutdown ){
        Logger::log("Could not find hookpoint core.pre_shutdown", Logger::LOG_ERROR);
    }else{
        _executeCommandsIn(pre_shutdown);
        delete pre_shutdown;
    }

    /* Unload the plug-ins */
    for(map<string, IPlugin*>::iterator it = _plugins.begin(); it != _plugins.end(); it++){
	IPlugin* plugin = it->second;
        Logger::log("Unloading " + plugin->getName(), Logger::LOG_INFO);
	delete plugin;
    }

    delete _config;

    /* elete the hookpoints */
    for(map<string, IHookPoint*>::iterator it = _hookpoints.begin(); it != _hookpoints.end(); it++){
        IHookPoint* hookpoint = it->second;
        delete hookpoint;
    }

}
开发者ID:coenbijlsma,项目名称:sentry-cpp,代码行数:28,代码来源:Sentry.cpp

示例7: initialize

void ConsoleWidget::initialize(IPluginManager *APluginManager)
{
	IPlugin *plugin = APluginManager->pluginInterface("IXmppStreams").value(0,NULL);
	if (plugin)
	{
		FXmppStreams = qobject_cast<IXmppStreams *>(plugin->instance());
		if (FXmppStreams)
		{
			foreach(IXmppStream *stream, FXmppStreams->xmppStreams())
				onStreamCreated(stream);

			connect(FXmppStreams->instance(), SIGNAL(created(IXmppStream *)), SLOT(onStreamCreated(IXmppStream *)));
			connect(FXmppStreams->instance(), SIGNAL(jidChanged(IXmppStream *, const Jid &)), SLOT(onStreamJidChanged(IXmppStream *, const Jid &)));
			connect(FXmppStreams->instance(), SIGNAL(streamDestroyed(IXmppStream *)), SLOT(onStreamDestroyed(IXmppStream *)));
		}
	}

	plugin = APluginManager->pluginInterface("IStanzaProcessor").value(0,NULL);
	if (plugin)
	{
		FStanzaProcessor = qobject_cast<IStanzaProcessor *>(plugin->instance());
		if (FStanzaProcessor)
		{
			foreach(int shandleId, FStanzaProcessor->stanzaHandles())
				onStanzaHandleInserted(shandleId,FStanzaProcessor->stanzaHandle(shandleId));
			connect(FStanzaProcessor->instance(),SIGNAL(stanzaHandleInserted(int, const IStanzaHandle &)),SLOT(onStanzaHandleInserted(int, const IStanzaHandle &)));
			ui.cmbCondition->clearEditText();
		}
	}

	connect(Options::instance(),SIGNAL(optionsOpened()),SLOT(onOptionsOpened()));
	connect(Options::instance(),SIGNAL(optionsClosed()),SLOT(onOptionsClosed()));
}
开发者ID:sanchay160887,项目名称:vacuum-im,代码行数:33,代码来源:consolewidget.cpp

示例8: Init

HRESULT Init(HWND hWnd)
{
	mod_file_system.Init("Core.FileSystem.dll");
	mod_dx9.Init("Engine.Graphics.DX9.dll");

	mod_file_system.CreateInstance(CLSID_CFileSystem, UUID_PPV(IFileSystem, &pFS));
	gEnv = &sgEnv;
	gEnv->Core = 0;
	gEnv->Logger = 0;
	gEnv->PluginManager = 0;
	gEnv->FileSystem = pFS;

	IPlugin *plug;
	mod_dx9.CreateInstance(UUID_PPV(IPlugin, &plug));
	plug->Initialize(gEnv, 0);
	plug->Release();

	mod_dx9.CreateInstance(UUID_PPV(IRenderer, &pRenderer));

	SRendererParams params;
	params.FullScreen = fullScreen;
	params.MainWindow = (WND_HANDLE)hWnd;
	params.ScreenHeight = iHeight;
	params.ScreenWidth = iWidth;
	params.BackBufferFormat = FMT_X8R8G8B8;
	pRenderer->Init(params);

	return InitGeometry();
}
开发者ID:mikhtonyuk,项目名称:3DEngine,代码行数:29,代码来源:d3dstuff.cpp

示例9: UnLoad

void PluginManager::UnLoad()
{
    // Before we unload the plugins, store the list of visible workspace tabs
    {
        wxArrayString visibleTabs;
        for(size_t i = 0; i < GetWorkspacePaneNotebook()->GetPageCount(); ++i) {
            visibleTabs.Add(GetWorkspacePaneNotebook()->GetPageText(i));
        }
        clConfig::Get().Write("VisibleWorkspaceTabs", visibleTabs);
    }

    // Now do the same for the output view
    {
        wxArrayString visibleTabs;
        for(size_t i = 0; i < GetOutputPaneNotebook()->GetPageCount(); ++i) {
            visibleTabs.Add(GetOutputPaneNotebook()->GetPageText(i));
        }
        clConfig::Get().Write("VisibleOutputTabs", visibleTabs);
    }

    std::map<wxString, IPlugin*>::iterator plugIter = m_plugins.begin();
    for(; plugIter != m_plugins.end(); plugIter++) {
        IPlugin* plugin = plugIter->second;
        plugin->UnPlug();
        delete plugin;
    }

    m_dl.clear();
    m_plugins.clear();
}
开发者ID:lpc1996,项目名称:codelite,代码行数:30,代码来源:pluginmanager.cpp

示例10: sm_CallStartFunction

static cell_t sm_CallStartFunction(IPluginContext *pContext, const cell_t *params)
{
	Handle_t hndl;
	HandleError err;
	IPlugin *pPlugin;

	ResetCall();

	hndl = static_cast<Handle_t>(params[1]);

	if (hndl == 0)
	{
		pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
	} else {
		pPlugin = g_PluginSys.PluginFromHandle(hndl, &err);

		if (!pPlugin)
		{
			return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", hndl, err);
		}
	}

	s_pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[2]);

	if (!s_pFunction)
	{
		return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
	}

	s_pCallable = static_cast<ICallable *>(s_pFunction);

	s_CallStarted = true;

	return 1;
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:35,代码来源:smn_functions.cpp

示例11: LogToFile

static cell_t LogToFile(IPluginContext *pContext, const cell_t *params)
{
	char *file;
	pContext->LocalToString(params[1], &file);

	char path[PLATFORM_MAX_PATH];
	g_pSM->BuildPath(Path_Game, path, sizeof(path), "%s", file);

	FILE *fp = fopen(path, "at");
	if (!fp)
	{
		return pContext->ThrowNativeError("Could not open file \"%s\"", path);
	}

	char buffer[2048];
	{
		DetectExceptions eh(pContext);
		g_pSM->SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
		g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 2);
		if (eh.HasException()) {
			fclose(fp);
			return 0;
		}
	}

	IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());

	g_Logger.LogToOpenFile(fp, "[%s] %s", pPlugin->GetFilename(), buffer);

	fclose(fp);

	return 1;
}
开发者ID:TheMadSword,项目名称:sourcemod,代码行数:33,代码来源:smn_core.cpp

示例12: Q_UNUSED

bool JabberSearch::initConnections(IPluginManager *APluginManager, int &AInitOrder)
{
    Q_UNUSED(AInitOrder);
    FPluginManager = APluginManager;

    IPlugin *plugin = APluginManager->pluginInterface("IStanzaProcessor").value(0,NULL);
    if (plugin)
    {
        FStanzaProcessor = qobject_cast<IStanzaProcessor *>(plugin->instance());
    }

    plugin = APluginManager->pluginInterface("IServiceDiscovery").value(0,NULL);
    if (plugin)
    {
        FDiscovery = qobject_cast<IServiceDiscovery *>(plugin->instance());
    }

    plugin = APluginManager->pluginInterface("IPresenceManager").value(0,NULL);
    if (plugin)
    {
        FPresenceManager = qobject_cast<IPresenceManager *>(plugin->instance());
    }

    plugin = APluginManager->pluginInterface("IDataForms").value(0,NULL);
    if (plugin)
    {
        FDataForms = qobject_cast<IDataForms *>(plugin->instance());
    }

    return FStanzaProcessor!=NULL;
}
开发者ID:fiftin,项目名称:vacuum-im,代码行数:31,代码来源:jabbersearch.cpp

示例13: backtrack

bool CAlgorithmSettingsModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
  if(CQJsonModel::setData(index, value,role))
  {
    CQJsonTreeItem* parentItem = backtrack(index);
    QJsonObject params;
    IPlugin* plugin = workflow->getStep(parentItem->row());

    CQJsonTreeItem* tempItem;
    int size = parentItem->getChilds()->size();
    for(int i = 0; i < size; i++)
    {
      tempItem = parentItem->getChilds()->value(i);
      QJsonObject o = tempItem->toJson();
      QString key = o.keys().at(0);
      params.insert(key, o.take(key));
    }

    if(plugin->ValidateParameters(&params))
    {
      plugin->getAlgorithm()->setParameters(params);
    }else{
        QString pluginM = plugin->Name();
        pluginM.append(" parameter not Valid!");
        CLogController::instance().frameworkMessage(pluginM);
    }
    return true;
  }

  return false;
}
开发者ID:boitumeloruf,项目名称:3DMuVi,代码行数:31,代码来源:CAlgorithmSettingsModel.cpp

示例14: ReadPlugin

static cell_t ReadPlugin(IPluginContext *pContext, const cell_t *params)
{
	Handle_t hndl = (Handle_t)params[1];
	HandleError err;
	IPluginIterator *pIter;

	HandleSecurity sec;
	sec.pIdentity = g_pCoreIdent;
	sec.pOwner = pContext->GetIdentity();

	if ((err=handlesys->ReadHandle(hndl, g_PlIter, &sec, (void **)&pIter)) != HandleError_None)
	{
		return pContext->ThrowNativeError("Could not read Handle %x (error %d)", hndl, err);
	}

	IPlugin *pPlugin = pIter->GetPlugin();
	if (!pPlugin)
	{
		return BAD_HANDLE;
	}

	pIter->NextPlugin();

	return pPlugin->GetMyHandle();
}
开发者ID:TheMadSword,项目名称:sourcemod,代码行数:25,代码来源:smn_core.cpp

示例15: sec

void ConVarManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name)
{
	/* Only check convars that have not been created by SourceMod's core */
	ConVarInfo *pInfo;
	if (!convar_cache_lookup(name, &pInfo))
	{
		return;
	}

	HandleSecurity sec(NULL, g_pCoreIdent);

	/* Remove it from our cache */
	m_ConVars.remove(pInfo);
	convar_cache.remove(name);

	/* Now make sure no plugins are referring to this pointer */
	IPluginIterator *pl_iter = scripts->GetPluginIterator();
	while (pl_iter->MorePlugins())
	{
		IPlugin *pl = pl_iter->GetPlugin();

		ConVarList *pConVarList;
		if (pl->GetProperty("ConVarList", (void **)&pConVarList, true) 
			&& pConVarList != NULL)
		{
			pConVarList->remove(pInfo->pVar);
		}

		pl_iter->NextPlugin();
	}

	/* Free resources */
	handlesys->FreeHandle(pInfo->handle, &sec);
	delete pInfo;
}
开发者ID:Markusyatina,项目名称:sourcemod,代码行数:35,代码来源:ConVarManager.cpp


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