5 #include <plugify/path.hpp>
6 #include <plugify/reference_wrapper.hpp>
7 #include <plugify_export.h>
11 class LanguageModuleDescriptorRef;
20 enum class ModuleState : uint8_t {
31 using UniqueId = std::ptrdiff_t;
44 UniqueId
GetId() const noexcept;
50 std::string_view GetName() const noexcept;
56 std::string_view GetLanguage() const noexcept;
62 std::string_view GetFriendlyName() const noexcept;
68 std::filesystem::path_view GetFilePath() const noexcept;
74 std::filesystem::path_view GetBaseDir() const noexcept;
86 ModuleState GetState() const noexcept;
92 std::string_view GetError() const noexcept;
115 std::optional<std::filesystem::path_view> FindResource(std::filesystem::path_view path) const;
122 namespace ModuleUtils {
128 [[maybe_unused]] constexpr std::string_view ToString(ModuleState state) noexcept {
130 case ModuleState::NotLoaded:
return "NotLoaded";
131 case ModuleState::Error:
return "Error";
132 case ModuleState::Loaded:
return "Loaded";
133 default:
return "Unknown";
142 [[maybe_unused]] constexpr ModuleState FromString(std::string_view state) noexcept {
143 if (state ==
"NotLoaded") {
144 return ModuleState::NotLoaded;
145 }
else if (state ==
"Error") {
146 return ModuleState::Error;
147 }
else if (state ==
"Loaded") {
148 return ModuleState::Loaded;
150 return ModuleState::Unknown;
A reference class for the LanguageModuleDescriptor structure.
Reference wrapper to access language module's information.
UniqueId GetId() const noexcept
Get the unique identifier of the language module.
A lightweight reference wrapper for objects of type T.