📄 error.hh
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -