本文整理汇总了C++中CExtension类的典型用法代码示例。如果您正苦于以下问题:C++ CExtension类的具体用法?C++ CExtension怎么用?C++ CExtension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CExtension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindExtensionByFile
IExtension *CExtensionManager::FindExtensionByFile(const char *file)
{
List<CExtension *>::iterator iter;
CExtension *pExt;
/* Chomp off the path */
char lookup[PLATFORM_MAX_PATH];
g_LibSys.GetFileFromPath(lookup, sizeof(lookup), file);
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
pExt = (*iter);
char short_file[PLATFORM_MAX_PATH];
g_LibSys.GetFileFromPath(short_file, sizeof(short_file), pExt->GetFilename());
if (strcmp(lookup, short_file) == 0)
{
return pExt;
}
}
/* If we got no results, test if there was a platform extension.
* If not, add one.
*/
if (!strstr(file, "." PLATFORM_LIB_EXT))
{
char path[PLATFORM_MAX_PATH];
UTIL_Format(path, sizeof(path), "%s.%s", file, PLATFORM_LIB_EXT);
return FindExtensionByFile(path);
}
return NULL;
}
示例2: 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;
}
示例3: sizeof
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;
}
示例4: sizeof
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;
}
示例5:
IExtension *CExtensionManager::FindExtensionByName(const char *ext)
{
List<CExtension *>::iterator iter;
CExtension *pExt;
IExtensionInterface *pAPI;
const char *name;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
pExt = (*iter);
if (!pExt->IsLoaded())
{
continue;
}
if ((pAPI = pExt->GetAPI()) == NULL)
{
continue;
}
name = pAPI->GetExtensionName();
if (!name)
{
continue;
}
if (strcmp(name, ext) == 0)
{
return pExt;
}
}
return NULL;
}
示例6: CreateExtension
ALERROR CExtension::CreateExtension (SDesignLoadCtx &Ctx, CXMLElement *pDesc, EFolderTypes iFolder, CExternalEntityTable *pEntities, CExtension **retpExtension)
// CreateExtension
//
// Loads the given extension or adventure. We take ownership of pEntities.
{
ALERROR error;
int i;
// Create an extension object
CExtension *pExtension;
if (error = CreateExtensionFromRoot(Ctx.sResDb, pDesc, iFolder, pEntities, Ctx.dwInheritAPIVersion, &pExtension, &Ctx.sError))
return error;
// Set up context
Ctx.pExtension = pExtension;
// Load all the design elements
for (i = 0; i < pDesc->GetContentElementCount(); i++)
{
CXMLElement *pItem = pDesc->GetContentElement(i);
if (error = pExtension->LoadDesignElement(Ctx, pItem))
{
pExtension->m_pEntities = NULL; // Let our parent clean up.
delete pExtension;
return error;
}
}
// If this is an adventure and we have no adventure descriptor then we
// fail.
if (pExtension->m_iType == extAdventure && pExtension->m_pAdventureDesc == NULL)
{
pExtension->m_pEntities = NULL; // Let our parent clean up.
delete pExtension;
Ctx.sError = CONSTLIT("Adventure must have an AdventureDesc type.");
return ERR_FAIL;
}
pExtension->AddDefaultLibraryReferences(Ctx);
// Restore
Ctx.pExtension = NULL;
// Done
pExtension->m_iLoadState = (Ctx.bLoadAdventureDesc ? loadAdventureDesc : loadComplete);
*retpExtension = pExtension;
return NOERROR;
}
示例7: initializeExtension
DLLEXPORT void initializeExtension( CExtension &extension )
{
extension.Requires( "ieCore" );
extension.RegisterTranslator(
"ieProceduralHolder",
"",
ProceduralHolderTranslator::creator,
ProceduralHolderTranslator::nodeInitialiser
);
}
示例8: _moduleId
freettcn::CType::CType(const std::shared_ptr<const TciModuleId> &moduleId,
const Tstring &name,
const TciTypeClass &typeClass,
const Tstring &encoding,
const Tstring &encodingVariant,
const CExtension &extension):
_moduleId(moduleId), _name(new Tstring(name)), _class(typeClass), _encoding(new Tstring(encoding)), _encodingVariant(new Tstring(encodingVariant)), _extension(new CExtension)
{
std::for_each(extension.begin(), extension.end(),
[this](Tstring *str) { _extension->push_back(new Tstring(*str)); });
}
示例9: GetExtensionFromIdent
void CExtensionManager::AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface)
{
CExtension *pExt = (CExtension *)ext;
CExtension *pOwner = GetExtensionFromIdent(other);
IfaceInfo info;
info.iface = (SMInterface *)iface;
info.owner = pOwner;
pExt->AddDependency(&info);
pOwner->AddChildDependent(pExt, (SMInterface *)iface);
}
示例10: BindDependency
void CExtensionManager::BindDependency(IExtension *pRequester, IfaceInfo *pInfo)
{
CExtension *pExt = (CExtension *)pRequester;
CExtension *pOwner = (CExtension *)pInfo->owner;
pExt->AddDependency(pInfo);
IExtensionInterface *pAPI = pExt->GetAPI();
if (pAPI && !pAPI->QueryInterfaceDrop(pInfo->iface))
{
pOwner->AddChildDependent(pExt, pInfo->iface);
}
}
示例11: initializeExtension
DLLEXPORT void initializeExtension( CExtension &extension )
{
const char * pluginVersion = "1.2";
MString info = "MTOA gpuCache Translator v";
info += pluginVersion;
info += " using ";
info += Alembic::AbcCoreAbstract::GetLibraryVersion().c_str();
MGlobal::displayInfo(info);
extension.Requires( "gpuCache" );
extension.RegisterTranslator(
"gpuCache",
"",
BB_gpuCacheTranslator::creator,
BB_gpuCacheTranslator::nodeInitialiser
);
}
示例12: GetExtension
void CDesignCollection::GetEnabledExtensions (TArray<CExtension *> *retExtensionList)
// GetEnabledExtensions
//
// Returns the list of enabled extensions
{
int i;
retExtensionList->DeleteAll();
for (i = 0; i < GetExtensionCount(); i++)
{
CExtension *pEntry = GetExtension(i);
if (pEntry->GetType() == extExtension)
retExtensionList->Insert(pEntry);
}
}
示例13: MarkAllLoaded
void CExtensionManager::MarkAllLoaded()
{
List<CExtension *>::iterator iter;
CExtension *pExt;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
pExt = (*iter);
if (!pExt->IsLoaded())
{
continue;
}
if (pExt->m_bFullyLoaded)
{
continue;
}
pExt->MarkAllLoaded();
}
}
示例14: 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;
}
示例15: AddInterface
void CExtensionManager::AddInterface(IExtension *pOwner, SMInterface *pInterface)
{
CExtension *pExt = (CExtension *)pOwner;
pExt->AddInterface(pInterface);
}