|
Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
|
Owning literal bytes or a resource key, measured only at resolution. More...
#include <text_value.hpp>
Public Member Functions | |
| constexpr | ~TextValue ()=default |
| Release the independently owned expression bytes. | |
| constexpr | TextValue (const TextValue &other)=default |
| Copy expression bytes and kind into independent storage. | |
| constexpr TextValue & | operator= (const TextValue &other)=default |
| Replace expression bytes and kind with an owning copy. | |
| constexpr | TextValue (TextValue &&other)=default |
| Transfer expression storage using the standard library's default move. | |
| constexpr TextValue & | operator= (TextValue &&other)=default |
| Transfer expression storage using the standard library's default move assignment. | |
| constexpr | TextValue (std::string_view bytes) |
| Copy a literal buffer into independent expression storage. | |
| constexpr std::string_view | resourceKey () const noexcept |
| Inspect the resource key without resolving or allocating. | |
| constexpr bool | isEmptyLiteral () const noexcept |
| std::expected< GraphemeText, TextValueError > | resolve (WidthPolicy policy, TextLimits limits={}) const |
| Resolve literal bytes without requiring a resource resolver. | |
| template<class Resolver> requires std::invocable<Resolver, std::string_view> && std::same_as<std::invoke_result_t<Resolver, std::string_view>, std::expected<std::string, TextResourceError>> | |
| std::expected< GraphemeText, TextValueError > | resolve (WidthPolicy policy, Resolver &&resolver, TextLimits limits={}) const |
| Resolve a key synchronously through the caller, or validate a literal directly. | |
Friends | |
| class | ManagedScene |
| constexpr TextValue | i18n (std::string_view key) |
| Copy a resource key for later resolution through an explicit caller. | |
Owning literal bytes or a resource key, measured only at resolution.
No locale, resolver, display policy or mutable global state is retained. Construction copies bytes without validation, repair or normalization. Resolution validates under the receiving scene's explicit policy. Re-resolve after changing policy or resources; the caller owns layout/paint invalidation. Independent values have no thread affinity. Concurrent reads are safe when the caller's resolver is safe; mutation/destruction require synchronization. Construction and copy may throw std::bad_alloc or std::length_error. With the MSVC standard library and nonzero _ITERATOR_DEBUG_LEVEL, rvalue construction/assignment use fallible owning copies to avoid noexcept proxy allocation. Other library modes retain their default string moves.
|
constexprdefault |
Copy expression bytes and kind into independent storage.
| other | Source expression; copying may allocate and leaves it unchanged. |
|
constexprdefault |
Transfer expression storage using the standard library's default move.
| other | Source expression; its moved-from value remains valid but unspecified. |
|
inlineexplicitconstexpr |
Copy a literal buffer into independent expression storage.
| bytes | Literal bytes borrowed only during construction, including invalid UTF-8. |
| std::bad_alloc | If expression storage cannot be allocated. |
| std::length_error | If the buffer exceeds string storage limits. |
|
inlinenodiscardconstexprnoexcept |
Replace expression bytes and kind with an owning copy.
| other | Source expression; self-assignment is supported. |
Transfer expression storage using the standard library's default move assignment.
| other | Source expression; existing storage is released. |
|
inlinenodiscard |
Resolve a key synchronously through the caller, or validate a literal directly.
| Resolver | Callable accepting std::string_view and returning exactly expected<string, TextResourceError>. Move-only callables are supported; the callable is not copied or retained. |
| policy | Owning display policy captured by the resulting text. |
| resolver | Borrowed for this call; invoked once for a key and never for a literal. The key view is borrowed only for the callback. Resource acquisition must not block paint/measure. |
| limits | Resource caps applied to the entire resolved buffer, including translated bytes. |
| std::bad_alloc | If the callback or text storage allocation fails. |
| std::length_error | If the callback or text storage exceeds implementation limits. |
|
inlinenodiscard |
Resolve literal bytes without requiring a resource resolver.
| policy | Owning display policy captured by the resulting text. |
| limits | Resource caps applied to the entire resolved literal buffer. |
| std::bad_alloc | If validation storage cannot be allocated. |
| std::length_error | If validation storage exceeds implementation limits. |
|
inlinenodiscardconstexprnoexcept |
Inspect the resource key without resolving or allocating.
|
friend |
Copy a resource key for later resolution through an explicit caller.
| key | Opaque resource key borrowed only during this call; empty keys are permitted. |
| std::bad_alloc | If key storage cannot be allocated. |
| std::length_error | If key storage exceeds implementation limits. |