48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#pragma once
|
||
|
||
#include <QObject>
|
||
#include <QHash>
|
||
#include <QString>
|
||
#include <QStringList>
|
||
#include <QFutureWatcher>
|
||
|
||
#include "FunctionScanner.h"
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// FunctionIndex – Singleton-artiger Index aller Projektfunktionen.
|
||
// Wird von CodeEditor (Doppelklick-Navigation) und SignatureHelper genutzt.
|
||
// Aktualisiert sich asynchron wenn setProjectRoot() aufgerufen wird.
|
||
// ---------------------------------------------------------------------------
|
||
class FunctionIndex : public QObject
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit FunctionIndex(QObject *parent = nullptr);
|
||
|
||
void setProjectRoot(const QString &path);
|
||
void refresh();
|
||
|
||
// Sucht eine Funktion nach Name (Groß-/Kleinschreibung ignoriert)
|
||
// Gibt ungültige FunctionInfo zurück wenn nicht gefunden (filePath ist leer)
|
||
FunctionScanner::FunctionInfo lookup(const QString &name) const;
|
||
|
||
bool isReady() const;
|
||
|
||
signals:
|
||
void indexReady();
|
||
|
||
private slots:
|
||
void onScanFinished();
|
||
|
||
private:
|
||
QString m_projectRoot;
|
||
FunctionScanner *m_scanner = nullptr;
|
||
|
||
QFutureWatcher<QList<FunctionScanner::FunctionInfo>> *m_watcher = nullptr;
|
||
|
||
// name.toLower() → FunctionInfo
|
||
QHash<QString, FunctionScanner::FunctionInfo> m_index;
|
||
bool m_ready = false;
|
||
};
|