Laxkit  0.0.7.1
errorlog.h
1 //
2 //
3 // Laidout, for laying out
4 // Please consult http://www.laidout.org about where to send any
5 // correspondence about this software.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 // For more details, consult the COPYING file in the top directory.
12 //
13 // Copyright (C) 2012 by Tom Lechner
14 //
15 #ifndef ERRORLOG_H
16 #define ERRORLOG_H
17 
18 
19 #include <lax/lists.h>
20 
21 
22 namespace Laxkit {
23 
24 
25 //---------------------------------- ErrorLog -----------------------------
26 
33  ERROR_Unknown =-1,
34  ERROR_Ok =0,
35  ERROR_Fail =1,
36  ERROR_Warning =2,
37  //ERROR_Missing_Glyphs,
38  //ERROR_Unexposed_Text,
39  //ERROR_Has_Transparency,
40  //ERROR_Broken_Image,
41  //ERROR_Broken_Resource,
42  //ERROR_Image_Not_At_Desired_Resolution,
43  ERROR_MAX
44 
45  };
46 
48 {
49  public:
50  char *path;
51  char *objectstr_id;
52  unsigned int object_id;
53  char *description;
54  int severity; //"ok", "warning", "fail", "version fail"
55  int info, pos,line; //extra info
56  ErrorLogNode();
57  ErrorLogNode(unsigned int objid, const char *objidstr, const char *npath, const char *desc, int nseverity,int ninfo, int npos,int nline);
58  virtual ~ErrorLogNode();
59  virtual void Set(unsigned int objid, const char *objidstr, const char *npath, const char *desc, int nseverity,int ninfo, int npos,int nline);
60 };
61 
62 class ErrorLog
63 {
64  protected:
65  virtual ErrorLogNode *newErrorLogNode();
66  public:
68 
69  ErrorLog();
70  virtual ~ErrorLog();
71  virtual int AddMessage(const char *desc, int severity, int ninfo=0, int npos=0,int nline=0);
72  virtual int AddMessage(unsigned int objid, const char *objidstr, const char *npath, const char *desc, int severity, int ninfo=0, int npos=0,int nline=0);
73  virtual const char *Message(int i,int *severity,int *info, int *pos=NULL,int *line=NULL);
74  virtual int Total() { return messages.n; }
75  virtual ErrorLogNode *Message(int i);
76  virtual const char *MessageStr(int i);
77  virtual char *FullMessageStr();
78  virtual int Warnings(int since=0);
79  virtual int Errors(int since=0);
80  virtual int Oks(int since=0);
81  virtual void Clear();
82 };
83 
84 void dumperrorlog(const char *mes,ErrorLog &log);
85 
86 
87 } //namespace Laxkit
88 
89 
90 #endif
91 

Mon Feb 17 2014 11:52:56, Laxkit