plugify 1.0.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
plugify::PluginHandle Class Reference

Handle wrapper to access plugin's information. More...

#include <plugin.hpp>

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

Public Member Functions

UniqueId GetId () const noexcept
 Get the unique identifier of the plugin.
 
std::string_view GetName () const noexcept
 Get the name of the plugin.
 
std::string_view GetFriendlyName () const noexcept
 Get the friendly name of the plugin.
 
std::filesystem::path_view GetBaseDir () const noexcept
 Get the base directory of the plugin.
 
PluginDescriptorHandle GetDescriptor () const noexcept
 Get the descriptor of the plugin.
 
PluginState GetState () const noexcept
 Get the state of the plugin.
 
std::string_view GetError () const noexcept
 Get the error message associated with the plugin.
 
std::span< const MethodDataGetMethods () const noexcept
 Get the list of methods supported by the plugin.
 
MemAddr GetData () const noexcept
 The data argument specified when loading the plugin.
 
std::optional< std::filesystem::path_view > FindResource (std::filesystem::path_view path) const
 Find a resource file associated with the plugin.
 
- Public Member Functions inherited from plugify::Handle< const Plugin >
 Handle () noexcept
 Default constructor. Initializes the handle with a null pointer.
 
 Handle (const Plugin &impl) noexcept
 Constructs a Handle object from an instance of type T.
 
 Handle (const Handle &)=default
 Copy constructor. Creates a new Handle object from another Handle object.
 
 Handle (Handle &&)=default
 Move constructor. Transfers ownership from another Handle object.
 
auto operator<=> (const Handle &) const=default
 Comparison operator (<=>) for comparing two Handle objects.
 
Handleoperator= (const Handle &) &=default
 Copy assignment operator. Copies the handle from another Handle object.
 
Handleoperator= (const Handle &) &&=delete
 Copy assignment operator for rvalue references is deleted.
 
Handleoperator= (Handle &&) &=default
 Move assignment operator. Transfers ownership from another Handle object.
 
Handleoperator= (Handle &&) &&=delete
 Move assignment operator for rvalue references is deleted.
 
 operator bool () const noexcept
 Explicit conversion operator to bool, indicating if the pointer is non-zero.
 
 operator uintptr_t () const noexcept
 Converts the Handle object to a uintptr_t.
 
 operator void * () const noexcept
 Converts the Handle object to a void pointer.
 

Additional Inherited Members

- Protected Attributes inherited from plugify::Handle< const Plugin >
const Plugin * _impl
 A pointer to the referenced implementation of type T.
 

Detailed Description

Handle wrapper to access plugin's information.

Definition at line 46 of file plugin.hpp.

Member Function Documentation

◆ FindResource()

std::optional< std::filesystem::path_view > plugify::PluginHandle::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::PluginHandle::GetBaseDir ( ) const
noexcept

Get the base directory of the plugin.

Returns
The base directory as a filesystem path.

◆ GetData()

MemAddr plugify::PluginHandle::GetData ( ) const
noexcept

The data argument specified when loading the plugin.

Returns
The data of the plugin.

◆ GetDescriptor()

PluginDescriptorHandle plugify::PluginHandle::GetDescriptor ( ) const
noexcept

Get the descriptor of the plugin.

Returns
The descriptor of the plugin.

◆ GetError()

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

Get the error message associated with the plugin.

Returns
The error message.

◆ GetFriendlyName()

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

Get the friendly name of the plugin.

Returns
The friendly name of the plugin.

◆ GetId()

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

Get the unique identifier of the plugin.

Returns
The unique identifier.

◆ GetMethods()

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

Get the list of methods supported by the plugin.

Returns
The list of method data.

◆ GetName()

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

Get the name of the plugin.

Returns
The name of the plugin.

◆ GetState()

PluginState plugify::PluginHandle::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: