exception.h
来自「一个不错的fastdb使用例子」· C头文件 代码 · 共 73 行
H
73 行
//-< EXCEPTION.H >---------------------------------------------------*--------*
// FastDB Version 1.0 (c) 1999 GARRET * ? *
// (Main Memory Database Management System) * /\| *
// * / \ *
// Created: 3-Oct-99 Sebastiano Suraci * / [] \ *
// Last update: 5-Oct-99 K.A. Knizhnik * GARRET *
//-------------------------------------------------------------------*--------*
// Database exception
//-------------------------------------------------------------------*--------*
#ifndef __EXCEPTION_H__
#define __EXCEPTION_H__
class FASTDB_DLL_ENTRY dbException
{
protected:
int err_code;
char* msg;
int arg;
public:
dbException(int p_err_code, char const* p_msg = NULL, int p_arg = 0)
: err_code (p_err_code),
msg (NULL),
arg (p_arg)
{
if (p_msg != NULL)
{
msg = new char[strlen(p_msg)+1];
strcpy(msg, p_msg);
}
}
dbException(dbException const& ex)
{
err_code = ex.err_code;
arg = ex.arg;
if (ex.msg != NULL)
{
msg = new char[strlen(ex.msg)+1];
strcpy(msg, ex.msg);
}
else
{
msg = NULL;
}
}
~dbException()
{
delete[] msg;
}
int getErrCode() const
{
return err_code;
}
char* getMsg() const
{
return msg;
}
long getArg() const
{
return arg;
}
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?