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


C++ ObjectRef::QueryInterface方法代码示例

本文整理汇总了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;
        }
    }
开发者ID:btblog,项目名称:VoodooShader,代码行数:101,代码来源:VSCore.cpp


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