2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2018 Sergey Morozov
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2018-07-30 21:42:47 +03:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-09-20 11:33:57 +02:00
|
|
|
#include <utils/filepath.h>
|
2022-06-20 17:23:57 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2021-09-20 11:33:57 +02:00
|
|
|
|
2018-07-30 21:42:47 +03:00
|
|
|
#include <QHash>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
|
|
namespace Cppcheck {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class CppcheckTool;
|
|
|
|
|
|
|
|
|
|
class CppcheckRunner final : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit CppcheckRunner(CppcheckTool &tool);
|
|
|
|
|
~CppcheckRunner() override;
|
|
|
|
|
|
2021-09-30 16:58:46 +02:00
|
|
|
void reconfigure(const Utils::FilePath &binary, const QString &arguments);
|
2019-12-17 14:07:53 +01:00
|
|
|
void addToQueue(const Utils::FilePaths &files,
|
2018-07-30 21:42:47 +03:00
|
|
|
const QString &additionalArguments = {});
|
2019-12-17 14:07:53 +01:00
|
|
|
void removeFromQueue(const Utils::FilePaths &files);
|
|
|
|
|
void stop(const Utils::FilePaths &files = {});
|
2018-07-30 21:42:47 +03:00
|
|
|
|
2019-12-17 14:07:53 +01:00
|
|
|
const Utils::FilePaths ¤tFiles() const;
|
2018-07-30 21:42:47 +03:00
|
|
|
QString currentCommand() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void checkQueued();
|
|
|
|
|
void readOutput();
|
|
|
|
|
void readError();
|
2022-06-20 17:23:57 +02:00
|
|
|
void handleDone();
|
2018-07-30 21:42:47 +03:00
|
|
|
|
|
|
|
|
CppcheckTool &m_tool;
|
2022-06-20 17:23:57 +02:00
|
|
|
Utils::QtcProcess m_process;
|
2021-09-30 16:58:46 +02:00
|
|
|
Utils::FilePath m_binary;
|
2018-07-30 21:42:47 +03:00
|
|
|
QString m_arguments;
|
2019-12-17 14:07:53 +01:00
|
|
|
QHash<QString, Utils::FilePaths> m_queue;
|
|
|
|
|
Utils::FilePaths m_currentFiles;
|
2018-07-30 21:42:47 +03:00
|
|
|
QTimer m_queueTimer;
|
|
|
|
|
int m_maxArgumentsLength = 32767;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Cppcheck
|