|
ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
|
Model for displaying translation units in a tree view. More...
#include <TranslationUnitModel.h>
Public Member Functions | |
| TranslationUnitModel (FileManager &fileManager, QObject *parent=nullptr) | |
| bool | hasChildren (const QModelIndex &parent=QModelIndex()) const override |
| bool | canFetchMore (const QModelIndex &parent) const override |
| void | fetchMore (const QModelIndex &parent) override |
| void | populateFromDependencies (const QJsonObject &dependenciesJson, const QString &overrideProjectRoot=QString(), const QString &compilationDbPath=QString()) |
| Populate model from query-dependencies JSON output. | |
| QString | getSourceFilePathFromIndex (const QModelIndex &index) const |
| Get the source file path from a model index. | |
| QStringList | getIncludedHeadersForSource (const QString &sourceFilePath) const |
| Get all included headers for a source file. | |
| QModelIndex | findIndexByFilePath (const QString &filePath) const |
| Find model index by file path (legacy method for compatibility). | |
| QModelIndex | findIndexByAnyFilePath (const QString &filePath) const |
| QModelIndex | findIndexByAnyFilePathUnder (const QString &filePath, const QModelIndex &root) const |
| QModelIndex | findIndexByFileId (FileID fileId) const |
| Find model index by FileID. | |
| void | clear () |
| Clear all data from the model. | |
| QString | projectRoot () const |
| Get the computed project root directory. | |
Model for displaying translation units in a tree view.
This model represents the list of source files from the compilation database and their dependencies. It parses the JSON output from query-dependencies and displays it in a hierarchical structure with folders for direct and indirect includes.
Uses FileManager for consistent file identification via FileID throughout the application. File paths are stored for display purposes only.
Definition at line 47 of file TranslationUnitModel.h.
|
explicit |
Definition at line 198 of file TranslationUnitModel.cpp.
|
override |
Definition at line 526 of file TranslationUnitModel.cpp.
| void acav::TranslationUnitModel::clear | ( | ) |
Clear all data from the model.
Definition at line 811 of file TranslationUnitModel.cpp.
References clear().
Referenced by clear(), and populateFromDependencies().
|
override |
Definition at line 544 of file TranslationUnitModel.cpp.
| QModelIndex acav::TranslationUnitModel::findIndexByAnyFilePath | ( | const QString & | filePath | ) | const |
Definition at line 720 of file TranslationUnitModel.cpp.
| QModelIndex acav::TranslationUnitModel::findIndexByAnyFilePathUnder | ( | const QString & | filePath, |
| const QModelIndex & | root ) const |
Definition at line 750 of file TranslationUnitModel.cpp.
| QModelIndex acav::TranslationUnitModel::findIndexByFileId | ( | FileID | fileId | ) | const |
Find model index by FileID.
| fileId | FileID to find |
Definition at line 782 of file TranslationUnitModel.cpp.
References findIndexByFileId().
Referenced by findIndexByFileId().
| QModelIndex acav::TranslationUnitModel::findIndexByFilePath | ( | const QString & | filePath | ) | const |
Find model index by file path (legacy method for compatibility).
| filePath | Full path to the file to find |
Definition at line 684 of file TranslationUnitModel.cpp.
References findIndexByFilePath().
Referenced by findIndexByFilePath(), and getIncludedHeadersForSource().
| QStringList acav::TranslationUnitModel::getIncludedHeadersForSource | ( | const QString & | sourceFilePath | ) | const |
Get all included headers for a source file.
| sourceFilePath | Path to the source file |
Definition at line 632 of file TranslationUnitModel.cpp.
References findIndexByFilePath(), and getIncludedHeadersForSource().
Referenced by getIncludedHeadersForSource().
| QString acav::TranslationUnitModel::getSourceFilePathFromIndex | ( | const QModelIndex & | index | ) | const |
Get the source file path from a model index.
| index | QModelIndex from the tree view |
Definition at line 617 of file TranslationUnitModel.cpp.
References getSourceFilePathFromIndex().
Referenced by getSourceFilePathFromIndex().
|
override |
Definition at line 519 of file TranslationUnitModel.cpp.
| void acav::TranslationUnitModel::populateFromDependencies | ( | const QJsonObject & | dependenciesJson, |
| const QString & | overrideProjectRoot = QString(), | ||
| const QString & | compilationDbPath = QString() ) |
Populate model from query-dependencies JSON output.
| dependenciesJson | JSON object with structure: { "statistics": { "sourceFileCount": N, "totalHeaderCount": M }, "files": [ { "path": "...", "headerCount": N, "headers": [...] } ] } |
| overrideProjectRoot | Optional project root override (computed from sources if empty) |
| compilationDbPath | Path to compile_commands.json (used for tie-breaking) |
Definition at line 436 of file TranslationUnitModel.cpp.
References clear(), and populateFromDependencies().
Referenced by populateFromDependencies().
|
inline |
Get the computed project root directory.
Definition at line 98 of file TranslationUnitModel.h.