plugify  1.0.0.0
Public Member Functions | List of all members
plugify::PluginRef Class Reference

Reference wrapper to access for plugin's information. More...

#include <plugin.hpp>

Inheritance diagram for plugify::PluginRef:
Inheritance graph
[legend]
Collaboration diagram for plugify::PluginRef:
Collaboration graph
[legend]

Public Member Functions

UniqueId GetId () const noexcept
 Get the unique identifier of the plugin. More...
 
std::string_view GetName () const noexcept
 Get the name of the plugin. More...
 
std::string_view GetFriendlyName () const noexcept
 Get the friendly name of the plugin. More...
 
std::filesystem::path_view GetBaseDir () const noexcept
 Get the base directory of the plugin. More...
 
PluginDescriptorRef GetDescriptor () const noexcept
 Get the descriptor of the plugin. More...
 
PluginState GetState () const noexcept
 Get the state of the plugin. More...
 
std::string_view GetError () const noexcept
 Get the error message associated with the plugin. More...
 
std::span< const MethodData > GetMethods () const noexcept
 Get the list of methods supported by the plugin. More...
 
std::optional< std::filesystem::path_view > FindResource (std::filesystem::path_view path) const
 Find a resource file associated with the plugin. More...
 
- Public Member Functions inherited from plugify::Ref< const Plugin >
 Ref (const Plugin &impl) noexcept
 
 Ref (Ref const &)=default
 
 Ref (Ref &&)=default
 
bool operator== (const Ref &other) const noexcept
 
bool operator== (const const Plugin *impl) const noexcept
 
Refoperator= (const Ref &) &=default
 
Refoperator= (const Ref &) &&=delete
 
Refoperator= (Ref &&) &=default
 
Refoperator= (Ref &&) &&=delete
 
 operator bool () const noexcept
 

Additional Inherited Members

- Protected Attributes inherited from plugify::Ref< const Plugin >
const Plugin * _impl
 

Detailed Description

Reference wrapper to access for plugin's information.

Definition at line 52 of file plugin.hpp.

Member Function Documentation

◆ FindResource()

std::optional<std::filesystem::path_view> plugify::PluginRef::FindResource ( std::filesystem::path_view  path) const

Find a resource file associated with the plugin.

This method attempts to find a resource file located within the plugin's directory structure. If the resource file is found, its path is returned. If the resource file does not exist within the plugin's directory, std::nullopt is returned.

If a user-overridden file exists in the base directory of Plugify with the same name and path, the path returned by this function will direct to that overridden file.

Parameters
pathThe relative path to the resource file.
Returns
An optional containing the absolute path to the resource file if found, or std::nullopt otherwise.
Example:
// Assuming the plugin name is "sample_plugin"
// File located at: plugify/plugins/sample_plugin/configs/core.cfg
// User-overridden file could be located at: plugify/configs/core.cfg
auto resourcePath = plugin.FindResource("configs/core.cfg");

◆ GetBaseDir()

std::filesystem::path_view plugify::PluginRef::GetBaseDir ( ) const
noexcept

Get the base directory of the plugin.

Returns
The base directory as a filesystem path.

◆ GetDescriptor()

PluginDescriptorRef plugify::PluginRef::GetDescriptor ( ) const
noexcept

Get the descriptor of the plugin.

Returns
The descriptor of the plugin.

◆ GetError()

std::string_view plugify::PluginRef::GetError ( ) const
noexcept

Get the error message associated with the plugin.

Returns
The error message.

◆ GetFriendlyName()

std::string_view plugify::PluginRef::GetFriendlyName ( ) const
noexcept

Get the friendly name of the plugin.

Returns
The friendly name of the plugin.

◆ GetId()

UniqueId plugify::PluginRef::GetId ( ) const
noexcept

Get the unique identifier of the plugin.

Returns
The unique identifier.

◆ GetMethods()

std::span<const MethodData> plugify::PluginRef::GetMethods ( ) const
noexcept

Get the list of methods supported by the plugin.

Returns
The list of method data.

◆ GetName()

std::string_view plugify::PluginRef::GetName ( ) const
noexcept

Get the name of the plugin.

Returns
The name of the plugin.

◆ GetState()

PluginState plugify::PluginRef::GetState ( ) const
noexcept

Get the state of the plugin.

Returns
The state of the plugin.

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