welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
welder::rods::luacats::document Struct Reference

The growing LuaCATS document shared by every writer handle. More...

#include <welder/rods/lua/luacats/document.hpp>

Public Member Functions

void declare_table (std::string_view prefix, const char *doc=nullptr)
 Record (once) a module table to declare, updating its doc if given.
void record_type_name (std::string_view raw, std::string_view styled)
 Register a welded type's declared name so references to it are reconciled at render.
std::string render () const
 The finished stub text: the ---@meta header, the module tables shallowest first, then the accumulated declarations.

Public Attributes

std::vector< table_decltables {}
std::string body {}
std::vector< std::pair< std::string, std::string > > type_renames {}
 Raw C++ dotted name → styled/weld_as bound name, for reconciling type references* with their declarations at render (see apply_type_renames).

Detailed Description

The growing LuaCATS document shared by every writer handle.

Class/enum/function text lands in body; module tables are collected in tables and rendered (shallowest first) ahead of it, since a geometry.Point class or a geometry.foo function needs the geometry table to exist.

Definition at line 270 of file document.hpp.

Member Function Documentation

◆ declare_table()

void welder::rods::luacats::document::declare_table ( std::string_view prefix,
const char * doc = nullptr )
inline

Record (once) a module table to declare, updating its doc if given.

Parameters
prefixthe dotted table path to declare.
docthe table's namespace doc, or nullptr.

Definition at line 281 of file document.hpp.

References welder::doc(), and tables.

Referenced by welder::rods::luacats::rod::add_submodule(), and welder::rods::luacats::rod::set_module_doc().

◆ record_type_name()

void welder::rods::luacats::document::record_type_name ( std::string_view raw,
std::string_view styled )
inline

Register a welded type's declared name so references to it are reconciled at render.

A no-op when the name is unchanged (the welder::naming::none default, or a type the style/weld_as leaves alone), so the default stub is emitted byte-for-byte as before.

Parameters
rawthe type's raw C++ dotted name (qualified_name).
styledthe type's declared LuaCATS name (its class_writer::qualified).

Definition at line 297 of file document.hpp.

References type_renames.

Referenced by welder::rods::luacats::rod::make_class(), welder::rods::luacats::rod::make_enum(), welder::rods::luacats::rod::make_nested_class(), and welder::rods::luacats::rod::make_nested_enum().

◆ render()

std::string welder::rods::luacats::document::render ( ) const
inline

The finished stub text: the ---@meta header, the module tables shallowest first, then the accumulated declarations.

Returns
the complete LuaCATS document.

Definition at line 309 of file document.hpp.

References welder::rods::luacats::apply_type_renames(), body, welder::rods::luacats::emit_doc_comment(), tables, and type_renames.

Member Data Documentation

◆ body

std::string welder::rods::luacats::document::body {}

◆ tables

std::vector<table_decl> welder::rods::luacats::document::tables {}

Definition at line 271 of file document.hpp.

Referenced by declare_table(), and render().

◆ type_renames

std::vector<std::pair<std::string, std::string> > welder::rods::luacats::document::type_renames {}

Raw C++ dotted name → styled/weld_as bound name, for reconciling type references* with their declarations at render (see apply_type_renames).

Populated by record_type_name as each type is made.

Definition at line 276 of file document.hpp.

Referenced by record_type_name(), and render().


The documentation for this struct was generated from the following file: