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

Handle wrapper to access language module's information. More...

#include <module.hpp>

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

Public Member Functions

UniqueId GetId () const noexcept
 Get the unique identifier of the language module.
 
std::string_view GetName () const noexcept
 Get the name of the language module.
 
std::string_view GetLanguage () const noexcept
 Get the language of the language module.
 
std::string_view GetFriendlyName () const noexcept
 Get the friendly name of the language module.
 
std::filesystem::path_view GetFilePath () const noexcept
 Get the file path of the language module.
 
std::filesystem::path_view GetBaseDir () const noexcept
 Get the base directory of the language module.
 
LanguageModuleDescriptorHandle GetDescriptor () const noexcept
 Get the descriptor of the language module.
 
ModuleState GetState () const noexcept
 Get the state of the language module.
 
std::string_view GetError () const noexcept
 Get the error message associated with the language module.
 
std::optional< std::filesystem::path_view > FindResource (std::filesystem::path_view path) const
 Find a resource file associated with the module.
 
- Public Member Functions inherited from plugify::Handle< const Module >
 Handle () noexcept
 Default constructor. Initializes the handle with a null pointer.
 
 Handle (const Module &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 Module >
const Module * _impl
 A pointer to the referenced implementation of type T.
 

Detailed Description

Handle wrapper to access language module's information.

Definition at line 39 of file module.hpp.

Member Function Documentation

◆ FindResource()

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

Find a resource file associated with the module.

This method attempts to find a resource file located within the module's directory structure. If the resource file is found, its path is returned. If the resource file does not exist within the module'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 module name is "sample_module"
// File located at: plugify/modules/sample_module/configs/core.cfg
// User-overridden file could be located at: plugify/configs/core.cfg
auto resourcePath = module.FindResource("configs/core.cfg");

◆ GetBaseDir()

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

Get the base directory of the language module.

Returns
The base directory as a filesystem path.

◆ GetDescriptor()

LanguageModuleDescriptorHandle plugify::ModuleHandle::GetDescriptor ( ) const
noexcept

Get the descriptor of the language module.

Returns
The descriptor of the language module.

◆ GetError()

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

Get the error message associated with the language module.

Returns
The error message.

◆ GetFilePath()

std::filesystem::path_view plugify::ModuleHandle::GetFilePath ( ) const
noexcept

Get the file path of the language module.

Returns
The file path as a filesystem path.

◆ GetFriendlyName()

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

Get the friendly name of the language module.

Returns
The friendly name of the language module.

◆ GetId()

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

Get the unique identifier of the language module.

Returns
The unique identifier.

◆ GetLanguage()

std::string_view plugify::ModuleHandle::GetLanguage ( ) const
noexcept

Get the language of the language module.

Returns
The language of the language module.

◆ GetName()

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

Get the name of the language module.

Returns
The name of the language module.

◆ GetState()

ModuleState plugify::ModuleHandle::GetState ( ) const
noexcept

Get the state of the language module.

Returns
The state of the language module.

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