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


C++ CExtension::Load方法代码示例

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


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

示例1: LoadExtension

IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
{
	/* Remove platform extension if it's there. Compat hack. */
	const char *ext = libsys->GetFileExtension(file);
	if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
	{
		char path2[PLATFORM_MAX_PATH];
		smcore.Format(path2, sizeof(path2), "%s", file);
		path2[strlen(file) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
		return LoadExtension(path2, error, maxlength);
	}

	IExtension *pAlready;
	if ((pAlready=FindExtensionByFile(file)) != NULL)
	{
		return pAlready;
	}

	CExtension *pExt = new CLocalExtension(file);

	if (!pExt->Load(error, maxlength) || !pExt->IsLoaded())
	{
		pExt->Unload();
		delete pExt;
		return NULL;
	}

	/* :TODO: do QueryRunning check if the map is loaded */

	m_Libs.push_back(pExt);

	return pExt;
}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:33,代码来源:ExtensionSys.cpp

示例2: LoadAutoExtension

IExtension *CExtensionManager::LoadAutoExtension(const char *path)
{
	/* Remove platform extension if it's there. Compat hack. */
	const char *ext = libsys->GetFileExtension(path);
	if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
	{
		char path2[PLATFORM_MAX_PATH];
		smcore.Format(path2, sizeof(path2), "%s", path);
		path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
		return LoadAutoExtension(path2);
	}

	IExtension *pAlready;
	if ((pAlready=FindExtensionByFile(path)) != NULL)
	{
		return pAlready;
	}

	char error[256];
	CExtension *p = new CLocalExtension(path);

	/* We put us in the list beforehand so extensions that check for each other
	 * won't recursively load each other.
	 */
	m_Libs.push_back(p);

	if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
	{
		smcore.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
		p->SetError(error);
	}

	return p;
}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:34,代码来源:ExtensionSys.cpp

示例3: CRemoteExtension

IExtension *CExtensionManager::LoadExternal(IExtensionInterface *pInterface,
											const char *filepath,
											const char *filename,
											char *error,
											size_t maxlength)
{
	IExtension *pAlready;
	if ((pAlready=FindExtensionByFile(filename)) != NULL)
	{
		return pAlready;
	}

	CExtension *pExt = new CRemoteExtension(pInterface, filename, filepath);

	if (!pExt->Load(error, maxlength) || !pExt->IsLoaded())
	{
		pExt->Unload();
		delete pExt;
		return NULL;
	}

	m_Libs.push_back(pExt);

	return pExt;
}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:25,代码来源:ExtensionSys.cpp

示例4: LoadAutoExtension

IExtension *CExtensionManager::LoadAutoExtension(const char *path)
{
    if (!strstr(path, "." PLATFORM_LIB_EXT))
    {
        char newpath[PLATFORM_MAX_PATH];
        g_LibSys.PathFormat(newpath, sizeof(newpath), "%s.%s", path, PLATFORM_LIB_EXT);
        return LoadAutoExtension(newpath);
    }

    IExtension *pAlready;
    if ((pAlready=FindExtensionByFile(path)) != NULL)
    {
        return pAlready;
    }

    char error[256];
    CExtension *p = new CLocalExtension(path);

    /* We put us in the list beforehand so extensions that check for each other
     * won't recursively load each other.
     */
    m_Libs.push_back(p);

    if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
    {
        g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
        p->SetError(error);
    }

    return p;
}
开发者ID:asceth,项目名称:synapi,代码行数:31,代码来源:ExtensionSys.cpp

示例5: CLocalExtension

IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
{
    IExtension *pAlready;
    if ((pAlready=FindExtensionByFile(file)) != NULL)
    {
        return pAlready;
    }

    CExtension *pExt = new CLocalExtension(file);

    if (!pExt->Load(error, maxlength) || !pExt->IsLoaded())
    {
        pExt->Unload();
        delete pExt;
        return NULL;
    }

    /* :TODO: do QueryRunning check if the map is loaded */

    m_Libs.push_back(pExt);

    return pExt;
}
开发者ID:asceth,项目名称:synapi,代码行数:23,代码来源:ExtensionSys.cpp


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