ORE Studio 0.0.4
Loading...
Searching...
No Matches
PluginRegistry.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
16 * Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 */
19#ifndef ORES_QT_PLUGIN_REGISTRY_HPP
20#define ORES_QT_PLUGIN_REGISTRY_HPP
21
22#include <QString>
23#include <QVector>
24#include "ores.qt/export.hpp"
25#include "ores.qt/IPlugin.hpp"
26
27class QPluginLoader;
28
29namespace ores::qt {
30
35 QString filename;
36 QString message;
37};
38
50class ORES_QT_API PluginRegistry {
51public:
60 static PluginRegistry& instance();
61
68 static void initialise(PluginRegistry& registry);
69
77 void load_from_directory(const QString& plugin_dir);
78
84 const QVector<IPlugin*>& plugins() const { return plugins_; }
85
92 const QVector<plugin_load_error>& load_errors() const { return load_errors_; }
93
94 PluginRegistry() = default;
96 PluginRegistry(const PluginRegistry&) = delete;
97 PluginRegistry& operator=(const PluginRegistry&) = delete;
98
99private:
100
101 QVector<QPluginLoader*> loaders_;
102 QVector<IPlugin*> plugins_;
103 QVector<plugin_load_error> load_errors_;
104};
105
106}
107
108#endif
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Records a plugin that could not be loaded.
Definition PluginRegistry.hpp:34
QString filename
Short filename (e.g. libores.qt.admin.so)
Definition PluginRegistry.hpp:35
QString message
Human-readable error from QPluginLoader::errorString()
Definition PluginRegistry.hpp:36
Singleton registry that discovers and owns all loaded domain plugins.
Definition PluginRegistry.hpp:50
const QVector< IPlugin * > & plugins() const
Return the ordered list of successfully loaded plugins.
Definition PluginRegistry.hpp:84
const QVector< plugin_load_error > & load_errors() const
Return any errors collected during load_from_directory().
Definition PluginRegistry.hpp:92