DeltaQt
Version 0.2.0 End user documentation
A C++/Qt library for parsing DELTA (DEscription Language for TAxonomy) files
|
00001 /* Copyright 2012 Craig Robbins 00002 00003 This file is part of DeltaQt 00004 00005 DeltaQt is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 DeltaQt is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with DeltaQt. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef DELTAPARSELOG_H 00020 #define DELTAPARSELOG_H 00021 00022 #include <QString> 00023 #include <QStringList> 00024 #include <QList> 00025 00026 class DeltaLogEntry 00027 { 00028 public: 00029 00030 typedef enum 00031 { 00032 TYPE_INVALID = 0, 00033 TYPE_INFO = 1, 00034 TYPE_WARNING = 2, 00035 TYPE_ERROR = 4 00036 } Type; 00037 00038 typedef enum 00039 { 00040 STANDARD = 1, 00041 VERBOSE = 2, 00042 SUMMARY = 4 00043 00044 } Detail; 00045 00046 // Constructors 00047 DeltaLogEntry(); 00048 DeltaLogEntry(Type type, 00049 QString title, 00050 QString msg, 00051 Detail detail = STANDARD, 00052 int line = -1, 00053 int column = -1 00054 ); 00055 00056 Type type(void) const; 00057 Detail detail (void) const; 00058 QString title(void) const; 00059 QString msg(void) const; 00060 int line(void) const; 00061 int column(void) const; 00062 QString toText(bool verbose = true, char delim = '\t') const; 00063 00064 void set(Type type, 00065 QString title, 00066 QString msg, 00067 Detail detail = STANDARD, 00068 int line = -1, 00069 int column = -1 00070 00071 ); 00072 00073 void setRefName(QString to); 00074 void setMsg(QString to); 00075 void setLine(int to); 00076 void setColumn(int to); 00077 00078 bool isValid(void) const; 00079 protected: 00080 void setType(Type to); 00081 00082 Type m_type; 00083 Detail m_detail; 00084 QString m_refName; 00085 QString m_msg; 00086 int m_line; 00087 int m_column; 00088 }; 00089 00090 00091 00092 00093 typedef QList <DeltaLogEntry> DeltaLogEntries; 00094 00095 class DeltaParseLog 00096 { 00097 public: 00098 DeltaParseLog(); 00099 00100 static const unsigned FILTER_ALLOWALL = ~0U; 00101 static const unsigned FILTER_ALLVALIDTYPES = 00102 ~0U ^ DeltaLogEntry::TYPE_INVALID; 00103 static const unsigned DETAIL_ALLOW_ALL = ~0U; 00104 static const unsigned DETAIL_NOTVERBOSE = 00105 ~0U ^ DeltaLogEntry::VERBOSE; 00106 static const unsigned DETAIL_VERBOSE = 00107 ~0U; 00108 static const unsigned FILTER_ONLY_ERRORS = 00109 DeltaLogEntry::TYPE_ERROR; 00110 static const unsigned FILTER_ONLY_WARNINGS = 00111 DeltaLogEntry::TYPE_WARNING; 00112 00113 00114 QStringList allAsText(bool verbose = true, 00115 unsigned detailFilter = DETAIL_ALLOW_ALL, 00116 unsigned typeFilter = FILTER_ALLOWALL, 00117 char delim = '\t') const; 00118 00119 QString allAsTextCombined(bool verbose = true, 00120 unsigned detailFilter = DETAIL_ALLOW_ALL, 00121 unsigned typeFilter = FILTER_ALLOWALL, 00122 char delim = '\t', 00123 char eol = '\n') const; 00124 00125 void add(DeltaLogEntry::Type type, 00126 QString refName, 00127 QString msg, 00128 DeltaLogEntry::Detail detail = DeltaLogEntry::STANDARD, 00129 int line = -1, 00130 int column = -1 00131 ); 00132 00133 void clear(void); 00134 00135 protected: 00136 DeltaLogEntries m_logEntries; 00137 }; 00138 00139 #endif // DELTAPARSELOG_H