Resource API
Declared by <huxerui/resource.h>.
Resource identifiers
Section titled “Resource identifiers”ResourceId(domain, key) exposes Domain, Key, ToString, and equality. ImageResource, StringResource, and RawResource are distinct final ID types inheriting its constructors.
StringVariant
Section titled “StringVariant”Retains direct text or a localized template for an API that composes the value after the call returns.
Constructors accept empty, std::string, std::string_view, C string, or StringResource values.
Format(resource, arguments...) retains positional formatted arguments.
UseString(StringResource, arguments...) resolves immediately to std::string.
UseString(const StringVariant&) and UseString(StringVariant&&) resolve a retained value during the consumer’s composition.
Prefer Text::Format(resource, ...) for Text, UseString(resource, ...) for an immediate string, and StringVariant::Format only for a parameter whose declared type is StringVariant.
Locale and configuration
Section titled “Locale and configuration”Locale::FromLanguageTag, Locale::Default, and LanguageTag represent normalized locale choice. ResourceConfiguration contains locale and logical display_scale.
RawAsset
Section titled “RawAsset”Factories: FromBytes, CopyBytes, and FromSharedBytes. Queries: Bytes, AsStringView, ToString, MimeType, HasValue, and handle equality.
ImageAsset
Section titled “ImageAsset”Factories: FromFile, FromEncoded, and CopyEncoded, each with optional scale. Queries: EncodedBytes, Format, MimeType, pixel width/height, Scale, IntrinsicSize, HasValue, and handle equality. ImageFormat is Png or Jpeg; ImageSampling is Nearest or Linear.
Resolution
Section titled “Resolution”UseRawResource, UseImage, and UseVectorImage resolve generated IDs through the current resource configuration. PlatformResources is the adapter interface exposing Configuration() and synchronous immutable package Read(path).
Complete resource-consumer example
Section titled “Complete resource-consumer example”#include <huxerui/huxerui.h>
using namespace huxerui;
View InboxSummary(int unread_count) { const StringResource title("app", "inbox_title"); const ImageResource cover("app", "inbox_cover");
return Column { Text::Format(title, unread_count), Button(UseString(title, unread_count)), Image(cover).Fit(ImageFit::Cover), }.With(Spacing(12.0F));}Text::Format resolves text owned by Text; UseString resolves an immediate string for Button; Image receives its resource ID directly.

