⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exception.h

📁 网络socket,IO,线程池
💻 H
字号:
/*
   2003 by zhy
*/
#ifndef _MY_EXCEPTION_H
#define _MY_EXCEPTION_H


#include <exception>
#include <string>
#include <ostream>

namespace CommonInclude{


enum	ExceptionType
{
	CREATE_FILE_ERROR,
	CREATE_AUTOEVENT_ERROR,
	CREATE_MENALEVENT_ERROR,
	THREAD_START_ERROR
};

class CExceptionBase : public std::exception
{
public:	
	explicit CExceptionBase(int nCode,const char * lpszMsg) throw () : m_nCode(nCode),m_strMsg(lpszMsg) {}
	
	explicit CExceptionBase(int nCode,const std::string & strMsg) throw () : m_nCode(nCode),m_strMsg(strMsg) {}
	
	CExceptionBase(const CExceptionBase & re) throw () 
		: m_nCode(re.m_nCode),m_strMsg(re.m_strMsg) {}
	//! Destructor
	virtual ~CExceptionBase(void) throw() {}

	//! Return the error code
	int		GetErrorCode(void) const throw() { return m_nCode; }
	//! Return the error information
	const char * GetErrorInfo(void) const throw() { return m_strMsg.c_str(); }

	//! Return the error information. Overwrite the std::exception virtual function.
	virtual const char *what() const throw() {	return GetErrorInfo(); }
protected:
	int							m_nCode;
	std::string					m_strMsg;
};

}


#endif

⌨️ 快捷键说明

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