27 #include <unordered_set> 
   35 #include <QTextStream> 
   87         qDebug() << 
"Can't start checking if there's no files to check or if check is in progress.";
 
  101     for (
const std::string& addon: settings.
addons) {
 
  102         QString s = QString::fromStdString(addon);
 
  103         if (!addonsAndTools.contains(s))
 
  108         mThreads[i]->setAddonsAndTools(addonsAndTools);
 
  138     for (
int i = 
mThreads.size(); i < count; i++) {
 
  151         if (thread->isRunning()) {
 
  242     std::set<QString> modified;
 
  243     std::set<QString> unmodified;
 
  255     if (modified.find(filename) != modified.end())
 
  258     if (unmodified.find(filename) != unmodified.end())
 
  267     if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
 
  271     unmodified.insert(filename);
 
  274     while (!in.atEnd()) {
 
  275         QString line = in.readLine();
 
  276         if (line.startsWith(
"#include \"")) {
 
  278             const int i = line.indexOf(
"\"");
 
  280                 line.remove(i,line.length());
 
  281                 line = QFileInfo(filename).absolutePath() + 
"/" + line;
 
  283                     modified.insert(std::move(line));
 
void fileChecked(const QString &file)
 
void done()
cpp checking is done
 
Importing project settings.
 
Widget to show cppcheck progressbar and result.
 
void progress(int value, const QString &description)
Slot for updating the checking progress.
 
void error(const ErrorItem &item)
Slot for new error to be displayed.
 
This is just a container for general settings so that we don't need to pass individual values to func...
 
std::unordered_set< std::string > addons
addons, either filename of python/json file or json data
 
unsigned int jobs
How many processes/threads should do checking at the same time.
 
bool hasPreviousFiles() const
Have we checked files already?
 
void done()
Signal that all threads are done.
 
void check(const Settings &settings)
Start the threads to check the files.
 
QStringList mClangIncludePaths
 
bool needsReCheck(const QString &filename, std::set< QString > &modified, std::set< QString > &unmodified) const
Check if a file needs to be rechecked.
 
int mScanDuration
The previous scan duration in milliseconds.
 
QStringList mLastFiles
List of files checked last time (used when rechecking)
 
void removeThreads()
Function to delete all threads.
 
bool mAnalyseWholeProgram
 
void threadDone()
Slot that a single thread is done.
 
QDateTime getCheckStartTime() const
Get start time of last check.
 
QList< SuppressionList::Suppression > mSuppressions
 
QStringList mAddonsAndTools
 
void saveSettings(QSettings &settings) const
Save settings.
 
QDateTime mCheckStartTime
date and time when current checking started
 
ThreadResult mResults
Thread results are stored here.
 
void setThreadCount(const int count)
Set the number of threads to use.
 
ThreadHandler(QObject *parent=nullptr)
 
QDateTime mLastCheckTime
when was the files checked the last time (used when rechecking)
 
QStringList getReCheckFiles(bool all) const
Get files that should be rechecked because they have been changed.
 
~ThreadHandler() override
 
void stop()
Slot to stop all threads.
 
void debugError(const ErrorItem &item)
 
int mRunningThreadCount
The amount of threads currently running.
 
bool isChecking() const
Is checking running?
 
void log(const QString &msg)
 
QElapsedTimer mTimer
Timer used for measuring scan duration.
 
void setProject(const ImportProject &prj)
Set project to check.
 
int getPreviousFilesCount() const
Return count of files we checked last time.
 
void setCheckStartTime(QDateTime checkStartTime)
Set start time of check.
 
void clearFiles()
Clear all files from cppcheck.
 
int getPreviousScanDuration() const
Return the time elapsed while scanning the previous time.
 
void setCheckFiles(bool all)
Set files to check.
 
void initialize(const ResultsView *view)
Initialize the threads (connect all signals to resultsview's slots)
 
void setFiles(const QStringList &files)
Set files to check.
 
QList< CheckThread * > mThreads
List of threads currently in use.
 
void loadSettings(const QSettings &settings)
Load settings.
 
void clearFiles()
Clear files to check.
 
void error(const ErrorItem &item)
Signal of a new error.
 
void setProject(const ImportProject &prj)
 
void debugError(const ErrorItem &item)
Signal of a debug error.
 
void log(const QString &logline)
Signal of a new log message.
 
void fileChecked(const QString &file)
Slot threads use to signal this class that a specific file is checked.
 
void progress(int value, const QString &description)
Progress signal.
 
void setFiles(const QStringList &files)
Set list of files to check.
 
int getFileCount() const
Get the number of files to check.
 
#define SETTINGS_CHECK_THREADS