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

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

#include <module.hpp>

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

Public Member Functions

UniqueId GetId () const noexcept
 Get the unique identifier of the language module. More...
 
std::string_view GetName () const noexcept
 Get the name of the language module. More...
 
std::string_view GetLanguage () const noexcept
 Get the language of the language module. More...
 
std::string_view GetFriendlyName () const noexcept
 Get the friendly name of the language module. More...
 
std::filesystem::path_view GetFilePath () const noexcept
 Get the file path of the language module. More...
 
std::filesystem::path_view GetBaseDir () const noexcept
 Get the base directory of the language module. More...
 
LanguageModuleDescriptorRef GetDescriptor () const noexcept
 Get the descriptor of the language module. More...
 
ModuleState GetState () const noexcept
 Get the state of the language module. More...
 
std::string_view GetError () const noexcept
 Get the error message associated with the language module. More...
 
std::optional< std::filesystem::path_view > FindResource (std::filesystem::path_view path) const
 Find a resource file associated with the module. More...
 
- Public Member Functions inherited from plugify::Ref< const Module >
 Ref (const Module &impl) noexcept
 
 Ref (Ref const &)=default
 
 Ref (Ref &&)=default
 
bool operator== (const Ref &other) const noexcept
 
bool operator== (const const Module *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 Module >
const Module * _impl
 

Detailed Description

Reference wrapper to access language module's information.

Definition at line 37 of file module.hpp.

Member Function Documentation

◆ FindResource()

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

Get the base directory of the language module.

Returns
The base directory as a filesystem path.

◆ GetDescriptor()

LanguageModuleDescriptorRef plugify::ModuleRef::GetDescriptor ( ) const
noexcept

Get the descriptor of the language module.

Returns
The descriptor of the language module.

◆ GetError()

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

Get the error message associated with the language module.

Returns
The error message.

◆ GetFilePath()

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

Get the file path of the language module.

Returns
The file path as a filesystem path.

◆ GetFriendlyName()

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

Get the friendly name of the language module.

Returns
The friendly name of the language module.

◆ GetId()

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

Get the unique identifier of the language module.

Returns
The unique identifier.

◆ GetLanguage()

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

Get the language of the language module.

Returns
The language of the language module.

◆ GetName()

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

Get the name of the language module.

Returns
The name of the language module.

◆ GetState()

ModuleState plugify::ModuleRef::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: