Dateien, die als Parameter übergeben werden, werden nach dem Start direkt geladen
This commit is contained in:
47
barecode/src/editor/FunctionIndex.h
Normal file
47
barecode/src/editor/FunctionIndex.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#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;
|
||||
};
|
||||
Reference in New Issue
Block a user