ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
Loading...
Searching...
No Matches
QueryDependenciesRunner.h
Go to the documentation of this file.
1/*$!{
2* Aurora Clang AST Viewer (ACAV)
3*
4* Copyright (c) 2026 Min Liu
5* Copyright (c) 2026 Michael David Adams
6*
7* SPDX-License-Identifier: GPL-2.0-or-later
8*
9* This program is free software; you can redistribute it and/or modify
10* it under the terms of the GNU General Public License as published by
11* the Free Software Foundation; either version 2 of the License, or
12* (at your option) any later version.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License along
20* with this program; if not, see <https://www.gnu.org/licenses/>.
21}$!*/
22
25#pragma once
26
27#include <QElapsedTimer>
28#include <QJsonObject>
29#include <QObject>
30#include <QProcess>
31#include <QString>
32
33#include "core/LogEntry.h"
34
35namespace acav {
36
51class QueryDependenciesRunner : public QObject {
52 Q_OBJECT
53
54public:
55 explicit QueryDependenciesRunner(QObject *parent = nullptr);
56 ~QueryDependenciesRunner() override;
57
63 void run(const QString &compilationDatabasePath,
64 const QString &outputFilePath,
65 const QString &queryDependenciesBinary = QString());
66
68 bool isRunning() const;
69
72 void setClangResourceDir(const QString &dir) { clangResourceDir_ = dir; }
73
74signals:
77 void dependenciesReady(const QJsonObject &dependencies);
78
82 void dependenciesReadyWithErrors(const QJsonObject &dependencies,
83 const QStringList &errorMessages);
84
87 void error(const QString &errorMessage);
88
91 void progress(const QString &message);
92
94 void logMessage(const LogEntry &entry);
95
96private slots:
97 void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
98 void onProcessError(QProcess::ProcessError error);
99 void onProcessStdOut();
100 void onProcessStdErr();
101
102private:
103 QProcess *process_;
104 QString compilationDatabasePath_;
105 QString outputFilePath_;
106 QString clangResourceDir_;
107 QElapsedTimer elapsed_;
108 QString pendingStdout_;
109 QString pendingStderr_;
110};
111
112} // namespace acav
void logMessage(const LogEntry &entry)
Emitted when the tool produces log output.
void dependenciesReadyWithErrors(const QJsonObject &dependencies, const QStringList &errorMessages)
Emitted when query-dependencies completes with some errors.
bool isRunning() const
Check if query is currently running.
void progress(const QString &message)
Emitted with progress updates (e.g., "Running query-dependencies...").
void error(const QString &errorMessage)
Emitted when an error occurs.
void run(const QString &compilationDatabasePath, const QString &outputFilePath, const QString &queryDependenciesBinary=QString())
Run query-dependencies tool with the specified compilation database.
void setClangResourceDir(const QString &dir)
Set the Clang resource directory.
void dependenciesReady(const QJsonObject &dependencies)
Emitted when query-dependencies completes successfully.