Loading...
Searching...
No Matches
ml::PluginInfo Struct Reference

Lightweight metadata record for a discovered plugin. More...

#include <PluginInfo.h>

Public Attributes

std::string name
 Display name, from Plugin::getName().
std::string path
 Absolute path to the plugin shared library.
std::optional< sf::Texturethumbnail
std::string version
 Version string, from Plugin::getVersion().

Detailed Description

Lightweight metadata record for a discovered plugin.

PluginInfo is populated by PluginManager::scanPlugins() when it probes a directory for plugin shared libraries. Each record holds everything the host application needs to display a plugin in a carousel or menu — name, version, thumbnail image, and the path needed to load it — without keeping the plugin's dylib open or the Plugin object alive.

Thumbnail ownership

The thumbnail texture is copied from the GPU to a CPU-side sf::Texture before the probe plugin is unloaded. This means the texture pixel data in PluginInfo remains valid after the dylib is closed, and can be safely used to render a preview image without re-loading the plugin.

thumbnail is std::nullopt when the plugin's manifest does not declare Images::THUMBNAIL, or when the texture fails to load.

Typical use

std::vector<ml::PluginInfo> infos =
pluginManager.scanPlugins("path/to/plugins");
for (const auto& info : infos) {
std::cout << info.name << " v" << info.version << "\n";
if (info.thumbnail)
sprite.setTexture(*info.thumbnail);
}
// Load a specific plugin when the user selects it
pluginManager.loadPlugin(infos[0].path);
std::string path
Absolute path to the plugin shared library.
Definition PluginInfo.h:53
See also
PluginManager::scanPlugins, Plugin::getThumbnail

Definition at line 51 of file PluginInfo.h.

Member Data Documentation

◆ name

std::string ml::PluginInfo::name

Display name, from Plugin::getName().

Definition at line 54 of file PluginInfo.h.

◆ path

std::string ml::PluginInfo::path

Absolute path to the plugin shared library.

Definition at line 53 of file PluginInfo.h.

◆ thumbnail

std::optional<sf::Texture> ml::PluginInfo::thumbnail

CPU-side copy of the plugin thumbnail, or std::nullopt if unavailable.

Definition at line 56 of file PluginInfo.h.

◆ version

std::string ml::PluginInfo::version

Version string, from Plugin::getVersion().

Definition at line 55 of file PluginInfo.h.


The documentation for this struct was generated from the following file: