|
ZenitUI
Retained-mode C++20 UI framework
|
Tag → factory map plus the prefab table (either per-UIContext or standalone/global). More...
#include <ZMarkup.hpp>
Public Types | |
| using | Factory = std::function<std::shared_ptr<Layout>(const Element &)> |
| Signature for tag factories: Element → node. | |
Public Member Functions | |
| void | reg (const std::string &tag, Factory f) |
| Register or replace a tag factory. | |
| TagBuilder | tag (std::string_view name) |
| Fluent typed registration builder (drives parsing, defaults, validation, and docs). | |
| void | reg (TagDoc doc, Factory f) |
| Register or replace a tag together with its TagDoc metadata. | |
| const std::vector< TagDoc > & | tagDocs () const |
| Metadata of every tag registered with a TagDoc, in registration order. | |
| const TagDoc * | findTagDoc (std::string_view name) const |
Lookup metadata for name, or nullptr if unregistered/undocumented. | |
| std::vector< ZStyleDiagnostic > | validate (const Element &root) const |
| Static validation of a parsed tree against registered metadata. | |
| bool | hasTag (const std::string &tagName) const |
true if a tag factory is registered under tagName. | |
| bool | hasPrefab (const std::string &tagName) const |
true if a prefab is registered under tagName. | |
| void | registerPrefab (const std::string &tagName, const std::string &markupSource) |
| Register a prefab from inline markup source. | |
| bool | registerPrefabFile (const std::string &tagName, const std::filesystem::path &path) |
| Register a prefab from a file. | |
| bool | unregisterPrefab (const std::string &tagName) |
| Remove a previously registered prefab. | |
| void | clearPrefabs () |
| Remove all registered prefabs (leaves tag factories intact). | |
| std::vector< std::shared_ptr< Layout > > | create_impl (const Element &el, BuildContext &ctx, bool isPrefabRoot=false) const |
Build one or more nodes from el. | |
| std::shared_ptr< Layout > | create (const Element &el, BuildContext &ctx) const |
Convenience wrapper: build exactly one root node from el. | |
| UINode | build (std::string_view source, DiagnosticSink *sink=nullptr) const |
Parse and build a UINode from inline markup source using this registry. | |
| UINode | loadMarkupFile (const std::filesystem::path &path, DiagnosticSink *sink=nullptr) const |
Load, parse, and build a UINode from path using this registry. | |
| UINode | instantiate (const std::string &tagName, const std::vector< std::string > &extraClasses={}, const std::string &id="", const std::string &ref="") const |
| Directly instantiate a registered prefab without invoking the parser. | |
Static Public Member Functions | |
| static Registry | withBuiltins () |
| Create a standalone Registry pre-populated with all built-in widgets. | |
Tag → factory map plus the prefab table (either per-UIContext or standalone/global).
| std::shared_ptr< Layout > ZenitUI::ZMarkup::Registry::create | ( | const Element & | el, |
| BuildContext & | ctx ) const |
Convenience wrapper: build exactly one root node from el.
| bool ZenitUI::ZMarkup::Registry::registerPrefabFile | ( | const std::string & | tagName, |
| const std::filesystem::path & | path ) |
Register a prefab from a file.
| bool ZenitUI::ZMarkup::Registry::unregisterPrefab | ( | const std::string & | tagName | ) |
Remove a previously registered prefab.
tagName existed and was removed.
|
nodiscard |
Static validation of a parsed tree against registered metadata.
Reports UnknownTag, UnknownAttribute (with "did you mean" hints), and InvalidValue. Tags registered without a TagDoc (custom user tags) are skipped.