10static std::unexpected<Error>
Unbound(std::string reason)
17 auto [it, added] = _modules.try_emplace(moduleName);
24 return Unbound(std::format(
"module '{}' is not loaded", moduleName));
30 const std::string& baseName)
32 if (!baseName.empty())
34 const auto base =
Base(moduleName, className, baseName);
37 return std::unexpected(base.error());
41 return Unbound(std::format(
"'{}' has no vtable of its own in '{}'", baseName, className));
46 const auto module = Module(moduleName);
49 return std::unexpected(module.error());
51 auto [it, added] = _tables.try_emplace({moduleName, className},
nullptr);
58 return Unbound(std::format(
"no vtable for '{}' in '{}'", className, moduleName));
64 const std::string& baseName)
66 const auto module = Module(moduleName);
69 return std::unexpected(module.error());
71 auto key = std::tuple{moduleName, className, baseName};
72 auto it = _bases.find(key);
73 if (it == _bases.end())
75 it = _bases.emplace(std::move(key),
FindBaseIn(**module, className, baseName)).first;
Result< BaseSubobject > Base(const std::string &moduleName, const std::string &className, const std::string &baseName)
Result< void * > Table(const std::string &moduleName, const std::string &className, const std::string &baseName={})
Result< const Image * > Module(const std::string &moduleName)
bool FindImage(std::string_view moduleName, Image &module)
std::expected< T, Error > Result
Result< BaseSubobject > FindBaseIn(const Image &module, std::string_view className, std::string_view baseName)
static std::unexpected< Error > Unbound(std::string reason)
void * FindVirtualTableIn(const Image &module, std::string_view className)
static Error NotFound(std::string detail)