mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-07-17 20:44:32 -04:00
refactor: Replace singletone for context manager (#151)
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Petr Mironychev
|
||||
* Copyright (C) 2025 Petr Mironychev
|
||||
*
|
||||
* This file is part of QodeAssist.
|
||||
*
|
||||
@ -23,31 +23,30 @@
|
||||
#include <QString>
|
||||
|
||||
#include "ContentFile.hpp"
|
||||
#include "IDocumentReader.hpp"
|
||||
#include "IContextManager.hpp"
|
||||
#include "ProgrammingLanguage.hpp"
|
||||
#include "settings/GeneralSettings.hpp"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
}
|
||||
|
||||
namespace QodeAssist::Context {
|
||||
|
||||
class ContextManager : public QObject
|
||||
class ContextManager : public QObject, public IContextManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static ContextManager &instance();
|
||||
QString readFile(const QString &filePath) const;
|
||||
QList<ContentFile> getContentFiles(const QStringList &filePaths) const;
|
||||
|
||||
static ProgrammingLanguage getDocumentLanguage(const DocumentInfo &documentInfo);
|
||||
static bool isSpecifyCompletion(
|
||||
const DocumentInfo &documentInfo, const Settings::GeneralSettings &generalSettings);
|
||||
|
||||
private:
|
||||
explicit ContextManager(QObject *parent = nullptr);
|
||||
~ContextManager() = default;
|
||||
ContextManager(const ContextManager &) = delete;
|
||||
ContextManager &operator=(const ContextManager &) = delete;
|
||||
ContentFile createContentFile(const QString &filePath) const;
|
||||
~ContextManager() override = default;
|
||||
|
||||
QString readFile(const QString &filePath) const override;
|
||||
QList<ContentFile> getContentFiles(const QStringList &filePaths) const override;
|
||||
QStringList getProjectSourceFiles(ProjectExplorer::Project *project) const override;
|
||||
ContentFile createContentFile(const QString &filePath) const override;
|
||||
|
||||
ProgrammingLanguage getDocumentLanguage(const DocumentInfo &documentInfo) const override;
|
||||
bool isSpecifyCompletion(const DocumentInfo &documentInfo) const override;
|
||||
};
|
||||
|
||||
} // namespace QodeAssist::Context
|
||||
|
Reference in New Issue
Block a user