Files
softbus_daemon/src/core/plugin_system/PluginManager.h

46 lines
2.0 KiB
C
Raw Normal View History

2026-03-26 17:22:52 +08:00
#pragma once
#include <memory>
#include <QHash>
#include <QString>
2026-04-10 10:52:10 +08:00
#include <QStringList>
2026-03-26 17:22:52 +08:00
2026-04-07 14:20:04 +08:00
#include "core/plugin_system/IProtocolFramerPlugin.h"
2026-04-10 10:52:10 +08:00
#include "core/plugin_system/IProtocolMapperPlugin.h"
2026-03-26 17:22:52 +08:00
#include "core/plugin_system/IProtocolPlugin.h"
namespace softbus::core::plugin_system
{
class PluginManager
{
public:
PluginManager() = default;
void registerProtocolPlugin(std::shared_ptr<IProtocolPlugin> plugin);
2026-04-15 20:05:04 +08:00
std::shared_ptr<IProtocolPlugin> selectProtocolPlugin(softbus::core::models::ProtocolType protocol) const;
2026-04-07 14:20:04 +08:00
void unregisterProtocolPlugin(const QString& pluginId);
void registerProtocolFramerPlugin(std::shared_ptr<IProtocolFramerPlugin> plugin);
2026-04-15 20:05:04 +08:00
std::shared_ptr<IProtocolFramerPlugin> selectProtocolFramerPlugin(
softbus::core::models::ProtocolType protocol) const;
2026-04-07 14:20:04 +08:00
void unregisterProtocolFramerPlugin(const QString& pluginId);
2026-04-10 10:52:10 +08:00
void registerProtocolMapperPlugin(std::shared_ptr<IProtocolMapperPlugin> plugin);
2026-04-15 20:05:04 +08:00
std::shared_ptr<IProtocolMapperPlugin> selectProtocolMapperPlugin(
softbus::core::models::ProtocolType protocol) const;
2026-04-10 10:52:10 +08:00
void unregisterProtocolMapperPlugin(const QString& pluginId);
QStringList registeredProtocolPluginIds() const;
QStringList registeredProtocolFramerPluginIds() const;
QStringList registeredProtocolMapperPluginIds() const;
2026-03-26 17:22:52 +08:00
private:
2026-04-15 20:05:04 +08:00
QHash<QString, std::shared_ptr<IProtocolPlugin>> m_protocolPluginsById;
QHash<softbus::core::models::ProtocolType, std::shared_ptr<IProtocolPlugin>> m_protocolPluginsByType;
QHash<QString, std::shared_ptr<IProtocolFramerPlugin>> m_protocolFramerPluginsById;
QHash<softbus::core::models::ProtocolType, std::shared_ptr<IProtocolFramerPlugin>> m_protocolFramerPluginsByType;
QHash<QString, std::shared_ptr<IProtocolMapperPlugin>> m_protocolMapperPluginsById;
QHash<softbus::core::models::ProtocolType, std::shared_ptr<IProtocolMapperPlugin>> m_protocolMapperPluginsByType;
2026-03-12 14:56:53 +08:00
};
2026-03-26 17:22:52 +08:00
} // namespace softbus::core::plugin_system