資源簡介
實現了異常管理流程,實現方法詳細見頭文件
try
{
std::cout << "Hello World!\n";
}
catch (Exception * ex)
{
cout << "Ex:" <Message.c_str() << endl;
}
try
{
std::cout << "Hello World!\n";
}
catch (Exception * ex)
{
cout << "Ex:" <Message.c_str() << endl;
}

代碼片段和文件信息
#include?“Exception.h“
using?namespace?QtSharp;
Exception*?Exception::_exception?=?0;
Exception*?Exception::Instance()
{
if?(_exception?==?0)
{
_exception?=?new?Exception();
}
return?_exception;
}
void?Exception::SetMessage(string?file?int?line?string?function?string?msg)
{
char?tmp[64];
sprintf(tmp?“%d“?line);
Message?=?“發生異常,文件:“+file?+?“\t行:“?+?tmp?+?“\t方法:“?+?function?+?“\t描述:“?+?msg;
}
Exception::Exception():Message(““)
{
}
Exception::~Exception()
{
if?(_exception?!=?0)
{
delete?_exception;
_exception?=?0;
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????598??2019-10-02?11:05??Exception.cpp
?????文件?????????780??2019-10-02?11:03??Exception.h
- 上一篇:二掃文件瀏覽精靈(破解版)
- 下一篇:UDPServerClientTest.zip
評論
共有 條評論