本文整理汇总了C++中ObjectRef::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectRef::QueryInterface方法的具体用法?C++ ObjectRef::QueryInterface怎么用?C++ ObjectRef::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectRef
的用法示例。
在下文中一共展示了ObjectRef::QueryInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xpq_getName
//.........这里部分代码省略.........
{
pugi::xpath_query xpq_getPluginPaths(L"./Plugins/Path");
pugi::xpath_query xpq_getFilter(L"./@filter");
pugi::xpath_node_set nodes = xpq_getPluginPaths.evaluate_node_set(globalNode);
pugi::xpath_node_set::const_iterator iter = nodes.begin();
while (iter != nodes.end())
{
String filter = xpq_getFilter.evaluate_string(*iter);
String path = xpq_getText.evaluate_string(*iter);
m_Server->LoadPath(this, path, filter);
++iter;
}
}
{
pugi::xpath_query xpq_getPluginFiles(L"./Plugins/File");
pugi::xpath_node_set nodes = xpq_getPluginFiles.evaluate_node_set(globalNode);
pugi::xpath_node_set::const_iterator iter = nodes.begin();
while (iter != nodes.end())
{
String file = xpq_getText.evaluate_string(*iter);
m_Server->LoadPlugin(this, file);
++iter;
}
}
// Lookup classes
pugi::xpath_query fsQuery(L"./Classes/FileSystem/text()");
pugi::xpath_query hookQuery(L"./Classes/HookManager/text()");
String fsClass = m_Parser->Parse(fsQuery.evaluate_string(globalNode).c_str());
String hookClass = m_Parser->Parse(hookQuery.evaluate_string(globalNode).c_str());
// Load less vital classes
ObjectRef coreplugin = m_Server->CreateObject(this, hookClass);
IHookManager * phm = nullptr;
if (coreplugin && SUCCEEDED(coreplugin->QueryInterface(IID_IHookManager, (IObject**)&phm)) && phm)
{
m_HookManager = phm;
phm->Release();
}
else
{
StringFormat fmt(VSTR("Unable to create hook manager (class %1%).")); fmt << hookClass;
Throw(VOODOO_CORE_NAME, fmt, this);
}
coreplugin = m_Server->CreateObject(this, fsClass);
IFileSystem * pfs = nullptr;
if (coreplugin && SUCCEEDED(coreplugin->QueryInterface(IID_IFileSystem, (IObject**)&pfs)) && pfs)
{
m_FileSystem = pfs;
pfs->Release();
}
else
{
StringFormat fmt(VSTR("Unable to create file system (class %1%).")); fmt << fsClass;
Throw(VOODOO_CORE_NAME, fmt, this);
}
// ICore done loading
m_Logger->LogMessage(VSLog_CoreInfo, VOODOO_CORE_NAME, VSTR("Core initialization complete."));
// Call finalization events
this->CallEvent(EventIds::Finalize, 0, nullptr);
// Return
return VSF_OK;
}
catch (const Exception & exc)
{
if (m_Logger)
{
m_Logger->LogMessage(VSLog_CoreError, VOODOO_CORE_NAME,
StringFormat(VSTR("Exception during Core creation: %1%")) << exc.strwhat());
} else {
GlobalLog(VSTR("Unlogged exception during core creation: %S\n"), exc.what());
}
return VSF_FAIL;
}
catch (const std::exception & exc)
{
if (m_Logger)
{
m_Logger->LogMessage(VSLog_CoreError, VOODOO_CORE_NAME,
StringFormat(VSTR("Error during Core creation: %1%")) << exc.what());
} else {
GlobalLog(VSTR("Unlogged exception during core creation: %S\n"), exc.what());
}
return VSF_FAIL;
}
}