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


C++ CError::SetSeverity方法代码示例

本文整理汇总了C++中CError::SetSeverity方法的典型用法代码示例。如果您正苦于以下问题:C++ CError::SetSeverity方法的具体用法?C++ CError::SetSeverity怎么用?C++ CError::SetSeverity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CError的用法示例。


在下文中一共展示了CError::SetSeverity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ThrowAssertion

// ** When an exception is thrown, execution of the current function is stopped and 
// jumps directly to the catch block of the innermost exception frame. The 
// exception mechanism bypasses the normal exit path from a function. Therefore, 
// you must be sure to delete those memory blocks that would be deleted in a 
// normal exit. 
// static
void Library::ThrowAssertion(LPCSTR lpszFilename, int nLine, 
				LPCSTR lpszExpression, LPCSTR lpszError/*=NULL*/)
{
//	CAppException* pe = new CAppException(TRUE); // pass true if creating on the heap
	// Bug: can't just copy LPCTSTR pointer to string, because it might be a temporary object.
	// The error message was getting overwritten with FE EE's and didn't know what was going on - 
	// a CString was being passed here and then going out of scope because of the throw - 
	// so use strcpy or CStrings
//	pe->m_pszError = pszError; // store error message
//	pe->m_strError = "Assertion Failed";
//	throw pe;

//	CError e(_T("Assertion Failed"), TRUE);
//	e.SetFileLocation(lpszFilename, nLine, lpszExpression);
//	HandleError(e);

//	CError e(FALSE); // false because created on the stack
//	e.SetName(_T("Assertion Failed"));
//	e.SetSeverity(TRUE);
//	e.SetFileLocation(lpszFilename, nLine, lpszExpression);
//	throw &e;
	CError* pe = new CError(TRUE);
	if (lpszError==NULL)
		pe->SetName(_T("Assertion Failed"));
	else
		pe->SetName(lpszError);
	pe->SetSeverity(TRUE);
	pe->SetFileLocation(lpszFilename, nLine, lpszExpression);
	throw pe;
}
开发者ID:omerdagan84,项目名称:neomem,代码行数:36,代码来源:Library.cpp


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