本文整理汇总了C++中CAutoRefPtr::createLogger方法的典型用法代码示例。如果您正苦于以下问题:C++ CAutoRefPtr::createLogger方法的具体用法?C++ CAutoRefPtr::createLogger怎么用?C++ CAutoRefPtr::createLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAutoRefPtr
的用法示例。
在下文中一共展示了CAutoRefPtr::createLogger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tWinMain
ROBJ_IN_CPP
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
//必须要调用OleInitialize来初始化运行环境
HRESULT hRes = OleInitialize(NULL);
SASSERT(SUCCEEDED(hRes));
//LoadLibrary(L"E:\\soui.taobao\\richedit\\Debug\\riched20.dll");
/* XML预编译前面加载效率比较
pugi::xml_document doc;
LARGE_INTEGER perf;
QueryPerformanceFrequency(&perf);
LARGE_INTEGER t1,t2;
QueryPerformanceCounter(&t1);
doc.load_file(L"e:\\play.xml",pugi::parse_default,pugi::encoding_utf8);
QueryPerformanceCounter(&t2);
doc.save_file(L"e:\\play1.xml");
doc.save_bin(L"e:\\paly.xml.bin");
pugi::xml_document doc2;
LARGE_INTEGER t21,t22;
QueryPerformanceCounter(&t21);
doc2.load_bin_file(L"e:\\paly.xml.bin");
QueryPerformanceCounter(&t22);
doc2.save_file(L"e:\\play2.xml");
LONGLONG SP1 = (t2.QuadPart-t1.QuadPart)*1000000/perf.QuadPart;
LONGLONG SP2 = (t22.QuadPart-t21.QuadPart)*1000000/perf.QuadPart;
SStringW str;
str.Format(L"!!!!!sp2=%d,sp1=%d\n",(int)SP2,(int)SP1);
MessageBoxW(GetActiveWindow(),str,L"span",MB_OK);
return 0;
*/
int nRet = 0;
//使用imgdecoder-png图片解码模块演示apng动画
SComMgr *pComMgr = new SComMgr(_T("imgdecoder-png"));
{
int nType=MessageBox(GetActiveWindow(),_T("选择渲染类型:\n[yes]: Skia\n[no]:GDI\n[cancel]:Quit"),_T("select a render"),MB_ICONQUESTION|MB_YESNOCANCEL);
if(nType == IDCANCEL)
{
nRet = -1;
goto exit;
}
//定义一组类SOUI系统中使用的类COM组件
//CAutoRefPtr是一个SOUI系统中使用的智能指针类
CAutoRefPtr<IImgDecoderFactory> pImgDecoderFactory; //图片解码器,由imagedecoder-wid.dll模块提供
CAutoRefPtr<IRenderFactory> pRenderFactory; //UI渲染模块,由render-gdi.dll或者render-skia.dll提供
CAutoRefPtr<ITranslatorMgr> trans; //多语言翻译模块,由translator.dll提供
CAutoRefPtr<IScriptFactory> pScriptLua; //lua脚本模块,由scriptmodule-lua.dll提供
CAutoRefPtr<ILog4zManager> pLogMgr; //log4z对象
BOOL bLoaded=FALSE;
//从各组件中显式创建上述组件对象
if(nType == IDYES)
bLoaded = pComMgr->CreateRender_Skia((IObjRef**)&pRenderFactory);
else
bLoaded = pComMgr->CreateRender_GDI((IObjRef**)&pRenderFactory);
SASSERT_FMT(bLoaded,_T("load interface [%s] failed!"),nType==IDYES?_T("render_skia"):_T("render_gdi"));
bLoaded=pComMgr->CreateImgDecoder((IObjRef**)&pImgDecoderFactory);
SASSERT_FMT(bLoaded,_T("load interface [%s] failed!"),_T("imgdecoder"));
bLoaded=pComMgr->CreateTranslator((IObjRef**)&trans);
SASSERT_FMT(bLoaded,_T("load interface [%s] failed!"),_T("translator"));
if(pComMgr->CreateLog4z((IObjRef**)&pLogMgr))
if(pLogMgr){
pLogMgr->createLogger("soui");//support output soui trace infomation to log
pLogMgr->start();
}
//为渲染模块设置它需要引用的图片解码模块
pRenderFactory->SetImgDecoderFactory(pImgDecoderFactory);
//定义一个唯一的SApplication对象,SApplication管理整个应用程序的资源
SApplication *theApp=new SApplication(pRenderFactory,hInstance);
theApp->SetLogManager(pLogMgr);
LOGF("demo","test "<<100 << L"wchar");
SLOGFMTE("log output using ansi format,str=%s, tick=%u","test",GetTickCount());
SLOGFMTE(L"log output using unicode format,str=%s, tick=%u",L"中文",GetTickCount());
//控件注册要放到AddResProvider前: 2016年3月8日
//向SApplication系统中注册由外部扩展的控件及SkinObj类
SWkeLoader wkeLoader;
if(wkeLoader.Init(_T("wke.dll")))
//.........这里部分代码省略.........