📄 errormessage.h
字号:
/* $Id: ErrorMessage.h,v 1.7 1997/04/02 12:26:49 matt Exp $ Error/warning messages. (c) 1996 Matt Phillips. */#ifndef _ERRMSG_H#define _ERRMSG_H#include <std/string.h>#include <contain/LinkedListWithTail.h>// An error or warning message.class ErrorMessage{public: enum Type {Error, Warning}; // Construct a message. ErrorMessage (const string &msg, const string &f, int l, int c, Type t = Error) : message (msg), filename (f), line (l), column (c), messageType (t) {} // Construct a message using a char *. ErrorMessage (const char *msg, const char *f, int l, int c, Type t = Error) : message (msg), filename (f), line (l), column (c), messageType (t) {} string message, filename; int line, column; Type messageType;};// A list of error/warning messages.class ErrorMessageList : public TypeIOLinkedListWithTail(ErrorMessage){public: ErrorMessageList () {numErrors = numWarnings = 0;} virtual const char *name () const {return "Errors";} // Add a error message. void error (const string &msg, const string &file, int line, int column); // Add a warning message. void warning (const string &msg, const string &file, int line, int column); // Clear all messages. void clear (); // Return the number of error messages. int nErrors () const {return numErrors;} // Return the number of warning messages. int nWarnings () const {return numWarnings;} // Merge this message list with <list> (this list is cleared). void mergeWith (ErrorMessageList &list);protected: int numErrors, numWarnings;};// Writes a formatted ErrorMessage to <s>.ostream &operator << (ostream &s, const ErrorMessage &e);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -