error.hh
来自「一个mips虚拟机非常好代码,使用C++来编写的,希望大家多学学,」· HH 代码 · 共 67 行
HH
67 行
#ifndef error_hh_included#define error_hh_included#include "object.hh"// Centralized error handling using C++ exceptions. I'm imposing a limit of// 1023 characters on an generic error message, which should hardly be a// problem. The message is specified using a simplified printf() syntax, (see:// sulima/echo.cc), as I had the code handy, and it easily allows 64 bit// arguments.class Error : public Object{protected: // The message data. char msg[1024]; // Handle any cascaded errors (exceptions thrown in what()) static const char *cascaded(); // An empty constructor for derived classes. Error() { }public: // A printf-like constructor. Error(const char *m, ...); // Virtual destructor. virtual ~Error(); // Display the message. virtual const char *what() const;};// A cut-down `out of memory' error message.class OutOfMemory : public Error{public: const char *what() const;};// A generic error message stored in `errno'.class SysError : public Error{protected: int ec;public: SysError(); const char *what() const;};// A file-related SysError (the file name is printed before the message.)class FileError : public Error{public: FileError(const char *n);};#endif // error_hh_included
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?