KCoreAddons

kstaticpluginhelpers.cpp
1/*
2 SPDX-FileCopyrightText: 2021-2023 Alexander Lohnau <alexander.lohnau@gmx.de>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#include "kcoreaddons_export.h"
7#include "kstaticpluginhelpers_p.h"
8
10Q_GLOBAL_STATIC(StaticPluginMap, s_staticPlugins)
11
12QMap<QString, QStaticPlugin> KStaticPluginHelpers::staticPlugins(const QString &directory)
13{
14 return s_staticPlugins->value(directory);
15}
16
17std::optional<QStaticPlugin> KStaticPluginHelpers::findById(const QString &directory, const QString &pluginId)
18{
19 const auto staticPlugins = s_staticPlugins->value(directory);
20 const auto it = staticPlugins.constFind(pluginId);
21 return it == staticPlugins.end() ? std::nullopt : std::optional(it.value());
22}
23
24// Used in autogenerated code, see kcoreaddons_target_static_plugins
25KCOREADDONS_EXPORT void kRegisterStaticPluginFunction(const QString &pluginId, const QString &directory, QStaticPlugin plugin)
26{
27 (*s_staticPlugins)[directory].insert(pluginId, plugin);
28}
T value(const Key &key, const T &defaultValue) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.