|
Ultralight C++ API 2.0.0
|
Factories and tags for defining a type's data-binding schema.
#include <Ultralight/dom/data/Schema.h>
A schema declares which members of a native type the page can access. Passing entries to Schema() defines how HTML and CSS display your values and route user input back to native code.
This struct declares its schema as a schema member:
Each task pairs with an entry or tag:
| What the Page Needs | Entry or Tag |
|---|---|
| Show a value | Field() |
| Repeat rows | List() |
| Let the page request something | Action() |
| Set a CSS variable | Var() |
| Expose all members of a struct | Reflect() |
| Accept edits from a form control | Editable |
| Hide an entry from page markup | Internal |
| Deliver only the newest action | OnlyLatest |
| Check or clamp edits | Validate() |
Classes | |
| struct | EditableTag |
| Marks a field the page may request changes to. More... | |
| struct | InternalTag |
| Marks a field or list that pages can't reach. More... | |
| struct | OnlyLatestTag |
| Marks an action whose pending emissions collapse into the newest one. More... | |
| struct | FieldToken< Owner, Value, Accessor, Validator > |
| A field entry (the value Field() returns). More... | |
| struct | ListToken< Owner, Container, Accessor, KeyPtr > |
| A list entry (the value List() returns). More... | |
| struct | ActionToken< Payload > |
| An action entry (the value Action() returns). More... | |
| struct | VarToken< Owner, Value, Accessor > |
| A CSS custom property entry (the value Var() returns). More... | |
Functions | |
| template<typename Fn> requires std::is_class_v<Fn> | |
| consteval ValidateWith< Fn > | Validate (Fn fn) |
| Attach a validator to a field (a Field() tag). | |
| template<typename Fn> requires std::is_class_v<Fn> | |
| consteval ValidateEntry< Fn > | Validate (const char *name, Fn fn) |
| Attach a validator to an already-declared field (a Schema() entry). | |
| template<detail::IsAccessor A, typename... Tags> | |
| consteval auto | Field (const char *name, A accessor, Tags... tags) |
| Declare a field. | |
| template<typename Value, typename... Tags> requires (!detail::IsAccessor<Value>) | |
| consteval auto | Field (const char *name, Tags... tags) |
| Declare a field without an accessor. | |
| template<detail::IsAccessor A, typename KeyPtr, typename... Tags> requires std::is_member_object_pointer_v<KeyPtr> | |
| consteval auto | List (const char *name, A accessor, KeyPtr key, Tags... tags) |
| Declare a keyed list. | |
| template<detail::IsAccessor A, typename... Tags> requires (!std::is_member_object_pointer_v<Tags> && ...) | |
| consteval auto | List (const char *name, A accessor, Tags... tags) |
| Declare a list whose rows are matched by position. | |
| template<typename Payload = void, typename... Tags> | |
| consteval ActionToken< Payload > | Action (const char *name, Tags... tags) |
| Declare an action (a request the page sends to your code). | |
| template<detail::IsAccessor A> | |
| consteval auto | Var (const char *name, A accessor) |
| Declare a CSS custom property that follows your data. | |
| template<typename... Entries> | |
| consteval auto | Schema (Entries... entries) |
| Declare a type's schema. | |
Variables | |
| constexpr EditableTag | Editable {} |
| constexpr InternalTag | Internal {} |
| constexpr OnlyLatestTag | OnlyLatest {} |
Namespaces | |
| namespace | ultralight |
| Root namespace for every public Ultralight type, function, and enumeration. | |
| namespace | ultralight::dom |
| Direct C++ access to modify page elements and handle events. | |
| namespace | ultralight::dom::data |
| Data-binding API that connects native C++ data to HTML and CSS markup. | |
Enumerations | |
| enum | EntryFlags : uint8_t { kEntryFlags_Editable = 1 << 0 , kEntryFlags_Internal = 1 << 1 , kEntryFlags_OnlyLatest = 1 << 2 , kEntryFlags_Keyed = 1 << 3 , kEntryFlags_Var = 1 << 4 , kEntryFlags_Nullable = 1 << 5 } |
| Flags on a schema entry. More... | |