12 return Error::Invalid(std::format(
"'{}' must name the layout's source .xml, not the compiled resource", layout));
19 return std::unexpected(
Error::Invalid(
"a layout name is required"));
24 if (!layout.contains(
'/'))
27 if (layout.contains(
'.') && !isSourceXml)
38 "'{}' is outside {}, the only directory the addon whitelist allows layouts in", layout,
Directory)));
46 return LayoutPath(std::string(layout));
51 std::string_view name = _resource;
52 name.remove_prefix(name.rfind(
'/') + 1);
static Result< LayoutPath > Parse(std::string_view layout)
static constexpr std::string_view Directory
std::string_view Name() const noexcept
static constexpr std::string_view SourceExtension
std::expected< T, Error > Result
static Error NotSourceXml(std::string_view layout)
One failure: a code to branch on, text for the log, and an optional translation key.
static Error Invalid(std::string detail)