assert.cpp

来自「天之炼狱1服务器端源文件游戏服务端不完整」· C++ 代码 · 共 69 行

CPP
69
字号
//--------------------------------------------------------------------------------// // Filename   : Assert.cpp // Written By : Reiot////--------------------------------------------------------------------------------// include files#include "Types.h"#include "Assert.h"#include "Exception.h"#include <time.h>//--------------------------------------------------------------------------------//// __assert__//// 捞 窃荐俊辑绰 __BEGIN_TRY , __END_CATCH肺 wrapping且 鞘夸啊 绝促.////--------------------------------------------------------------------------------void __assert__ ( const char * file , uint line , const char * func , const char * expr )	throw ( AssertionError ){	StringStream msg;		msg << "\n"		<< "Assertion Failed : " << file << " : " << line;	if ( func )		msg << " : " << func;	time_t currentTime = time(0);		msg << expr << " at " << ctime(&currentTime);		ofstream ofile("assertion_failed.log",ios::app);	ofile << msg.toString() << endl;	ofile.close();	throw AssertionError( msg.toString() );}//--------------------------------------------------------------------------------//// 郴何俊 漂沥 蜡历甫 BAN 窍绊, 肺弊甫 巢扁绰 内靛啊 甸绢哎 荐 乐阑鳖?////--------------------------------------------------------------------------------void __protocol_assert__ ( const char * file , uint line , const char * func , const char * expr )	throw ( InvalidProtocolException ){	StringStream msg;		msg << "\n"		<< "Protocol Assertion Failed : " << file << " : " << line;	if ( func )		msg << " : " << func;	time_t currentTime = time(0);		msg << expr << " at " << ctime(&currentTime);		ofstream ofile("protocol_assertion_failed.log",ios::app);	ofile << msg.toString() << endl;	ofile.close();	throw InvalidProtocolException( msg.toString() );}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?