ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZMarkup.hpp File Reference

Declarative UI markup: parser, registry, prefab system, UINode, and WeakUINode. More...

#include "Common.hpp"
#include "Logger.hpp"
#include "Layout.hpp"
#include "Bindable.hpp"
#include "Diagnostics.hpp"
#include "ZMarkupDocs.hpp"
#include <filesystem>
#include <optional>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

Go to the source code of this file.

Classes

struct  ZenitUI::ZMarkup::Element
 Parsed representation of one markup node. More...
class  ZenitUI::ZMarkup::Parser
 Single-pass recursive-descent parser for ZMarkup source. More...
struct  ZenitUI::ZMarkup::SlotFrame
 Per-prefab-invocation slot routing table. More...
struct  ZenitUI::ZMarkup::ConditionBinding
 Runtime state for a structural If@ref block. More...
struct  ZenitUI::ZMarkup::IKeyedStore
 Type-erased storage base for keyed Each reconciliation. More...
struct  ZenitUI::ZMarkup::EachBinding
 Runtime state for a structural Each@ref prefab="..." slice. More...
struct  ZenitUI::ZMarkup::BuildContext
 Per-build accumulator for #id, @ref, and runtime structural bindings. More...
struct  ZenitUI::ZMarkup::KeyedStore< KeyT >
struct  ZenitUI::ZMarkup::KeyedStore< KeyT >::Entry
class  ZenitUI::ZMarkup::Registry
 Tag → factory map plus the prefab table (either per-UIContext or standalone/global). More...
class  ZenitUI::ZMarkup::UINode
 Root handle returned by build / instantiate: root node + build context + wiring helpers. More...
class  ZenitUI::ZMarkup::WeakUINode
 Non-owning handle to a UINode, safe to capture inside child callbacks. More...

Functions

Element ZenitUI::ZMarkup::parse (std::string_view src, std::string fileName="")
 Parse src into a single root Element.
void ZenitUI::ZMarkup::registerBuiltins (Registry &r)
 Register the built-in widgets into r.
Registry & ZenitUI::ZMarkup::getGlobalRegistry ()
 Return the global registry, initializing built-ins on first call.
void ZenitUI::ZMarkup::registerPrefab (const std::string &tagName, const std::string &markupSource)
bool ZenitUI::ZMarkup::registerPrefabFile (const std::string &tagName, const std::filesystem::path &path)
bool ZenitUI::ZMarkup::hasPrefab (const std::string &tagName)
UINode ZenitUI::ZMarkup::build (std::string_view source, DiagnosticSink *sink=nullptr)
UINode ZenitUI::ZMarkup::loadMarkupFile (const std::filesystem::path &path, DiagnosticSink *sink=nullptr)
UINode ZenitUI::ZMarkup::instantiate (const std::string &tagName, const std::vector< std::string > &extraClasses={}, const std::string &id="", const std::string &ref="")
void ZenitUI::ZMarkup::registerPrefab (UIContext &ctx, const std::string &tagName, const std::string &markupSource)
 Register a prefab scoped to ctx's ZMarkup::Registry.
bool ZenitUI::ZMarkup::registerPrefabFile (UIContext &ctx, const std::string &tagName, const std::filesystem::path &path)
 Register a prefab from file into ctx's ZMarkup::Registry.
bool ZenitUI::ZMarkup::hasPrefab (const UIContext &ctx, const std::string &tagName)
 true if ctx's ZMarkup::Registry has a prefab named tagName (never allocates lazily).
UINode ZenitUI::ZMarkup::build (std::string_view source, const Registry &registry, DiagnosticSink *sink=nullptr)
 Build markup source using an explicit registry.
UINode ZenitUI::ZMarkup::build (std::string_view source, UIContext &ctx, DiagnosticSink *sink=nullptr)
 Build markup source using ctx's ZMarkup::Registry.
UINode ZenitUI::ZMarkup::loadMarkupFile (const std::filesystem::path &path, const Registry &registry, DiagnosticSink *sink=nullptr)
 Load and build markup from path using an explicit registry.
UINode ZenitUI::ZMarkup::loadMarkupFile (const std::filesystem::path &path, UIContext &ctx, DiagnosticSink *sink=nullptr)
 Load and build markup from path using ctx's ZMarkup::Registry.
UINode ZenitUI::ZMarkup::instantiate (const Registry &registry, const std::string &tagName, const std::vector< std::string > &extraClasses={}, const std::string &id="", const std::string &ref="")
 Instantiate prefab tagName from an explicit registry.
UINode ZenitUI::ZMarkup::instantiate (UIContext &ctx, const std::string &tagName, const std::vector< std::string > &extraClasses={}, const std::string &id="", const std::string &ref="")
 Instantiate prefab tagName from ctx's ZMarkup::Registry.

Detailed Description

Declarative UI markup: parser, registry, prefab system, UINode, and WeakUINode.

Non-template implementation lives in src/zMarkup.cpp (compiled into libZenitUI). This header retains type definitions, declarations, and template methods only.