1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #include "pluginservicecontext.h" |
6 | |
7 | DPF_BEGIN_NAMESPACE |
8 | |
9 | PluginServiceContext &PluginServiceContext::instance() |
10 | { |
11 | static PluginServiceContext ctx; |
12 | return ctx; |
13 | } |
14 | |
15 | QStringList PluginServiceContext::services() |
16 | { |
17 | return PluginServiceContext::instance().keys(); |
18 | } |
19 | |
20 | bool PluginServiceContext::load(const QString &name, QString *errString) |
21 | { |
22 | auto ins = this->create(name, errString); |
23 | if (!ins) |
24 | return false; |
25 | if (!this->append(name, ins, errString)) |
26 | return false; |
27 | return true; |
28 | } |
29 | |
30 | bool PluginServiceContext::unload(const QString &name) |
31 | { |
32 | return this->remove(name); |
33 | } |
34 | |
35 | DPF_END_NAMESPACE |
36 |