errormessage.h

来自「用于词法分析的词法分析器」· C头文件 代码 · 共 76 行

H
76
字号
/*  $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 + =
减小字号Ctrl + -
显示快捷键?