|
Cppcheck
|
00001 /* 00002 * Cppcheck - A tool for static C/C++ code analysis 00003 * Copyright (C) 2007-2013 Daniel Marjamäki and Cppcheck team. 00004 * 00005 * This program 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 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef ERRORITEM_H 00020 #define ERRORITEM_H 00021 00022 #include <QString> 00023 #include <QStringList> 00024 #include <QMetaType> 00025 #include "errorlogger.h" 00026 00027 class ErrorLine; 00028 00029 /// @addtogroup GUI 00030 /// @{ 00031 00032 00033 /** 00034 * @brief GUI versions of severity conversions. 00035 * GUI needs wrappers for conversion functions since GUI uses Qt's QString 00036 * instead of the std::string used by lib/cli. 00037 */ 00038 class GuiSeverity { 00039 public: 00040 static QString toString(Severity::SeverityType severity) { 00041 return QString(Severity::toString(severity).c_str()); 00042 } 00043 00044 static Severity::SeverityType fromString(const QString &severity) { 00045 return Severity::fromString(severity.toStdString()); 00046 } 00047 }; 00048 00049 /** 00050 * @brief A class containing error data for one error. 00051 * 00052 * The paths are stored with internal ("/") separators. Only when we show the 00053 * path or copy if for user (to clipboard) we convert to native separators. 00054 * Full path is stored instead of relative path for flexibility. It is easy 00055 * to get the relative path from full path when needed. 00056 */ 00057 class ErrorItem { 00058 public: 00059 ErrorItem(); 00060 ErrorItem(const ErrorLine &line); 00061 00062 /** 00063 * @brief Convert error item to string. 00064 * @return Error item as string. 00065 */ 00066 QString ToString() const; 00067 00068 QString file; 00069 QStringList files; 00070 QString file0; 00071 QList<unsigned int> lines; 00072 QString errorId; 00073 Severity::SeverityType severity; 00074 bool inconclusive; 00075 QString summary; 00076 QString message; 00077 }; 00078 00079 Q_DECLARE_METATYPE(ErrorItem); 00080 00081 /** 00082 * @brief A class containing error data for one shown error line. 00083 */ 00084 class ErrorLine { 00085 public: 00086 QString file; 00087 unsigned int line; 00088 QString errorId; 00089 bool inconclusive; 00090 Severity::SeverityType severity; 00091 QString summary; 00092 QString message; 00093 }; 00094 00095 /// @} 00096 #endif // ERRORITEM_H
1.7.6.1