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
7DPF_BEGIN_NAMESPACE
8
9PluginServiceContext &PluginServiceContext::instance()
10{
11 static PluginServiceContext ctx;
12 return ctx;
13}
14
15QStringList PluginServiceContext::services()
16{
17 return PluginServiceContext::instance().keys();
18}
19
20bool 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
30bool PluginServiceContext::unload(const QString &name)
31{
32 return this->remove(name);
33}
34
35DPF_END_NAMESPACE
36