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

Classes

struct  document
 The growing generated header: the trampoline struct bodies and their trampoline_for registrations, kept apart so the structs can share one namespace generated { … } block and the registrations sit at global scope. More...
struct  rod
 The trampoline-generator rod: a stateless welder::rod that, instead of registering a live module, appends a compilable trampoline struct (plus its trampoline_for registration) for every welded virtual type it visits. More...

Functions

consteval std::string int_string (std::size_t n)
 Render a non-negative integer as decimal (constexpr std::to_string is not available on gcc-16 in a constant-evaluated context).
consteval std::string cpp_qualified_name (std::meta::info ent)
 The fully ::-qualified name of a namespace-scope entity, leading :: included (geometry::Point"::geometry::Point").
consteval std::string trampoline_ident (std::meta::info type)
 A collision-free identifier for type's generated trampoline: its qualified name with :: folded to _ (geometry::Pointgeometry_Point_trampoline).
consteval bool is_c_variadic (std::meta::info fn)
 Is fn a C-style variadic function (R(…, ...))?
consteval std::string qualifier_tokens (std::meta::info fn)
 The trailing cv / ref-qualifier / noexcept tokens of a member function fn, in grammatical order (" const & noexcept"), each with a leading space.
consteval std::string render_trampoline (std::meta::info type)
 Render the trampoline struct for welded virtual type type — one override per overridable virtual, each splicing the base's own reflected return/parameter types and forwarding to Python via WELDER_PY_OVERRIDE_AS (the slot-reflection form, so overloaded virtuals dispatch correctly).
consteval std::string render_registration (std::meta::info type)
 The trampoline_for<type> specialization pointing at type's generated struct.

Variables

constexpr const char * generated_namespace
 The namespace the generated trampoline structs are emitted into (fully qualified).

Function Documentation

◆ cpp_qualified_name()

std::string welder::rods::trampolines::cpp_qualified_name ( std::meta::info ent)
consteval

The fully ::-qualified name of a namespace-scope entity, leading :: included (geometry::Point"::geometry::Point").

Used both to name a trampoline's base and to splice the type in the generated file from any namespace.

Definition at line 51 of file document.hpp.

Referenced by render_registration(), and render_trampoline().

◆ int_string()

std::string welder::rods::trampolines::int_string ( std::size_t n)
consteval

Render a non-negative integer as decimal (constexpr std::to_string is not available on gcc-16 in a constant-evaluated context).

Definition at line 39 of file document.hpp.

Referenced by render_trampoline().

◆ is_c_variadic()

bool welder::rods::trampolines::is_c_variadic ( std::meta::info fn)
consteval

Is fn a C-style variadic function (R(…, ...))?

C++26 reflection has no ellipsis/variadic predicate, so this reads the ellipsis back out of the implementation's type spelling — acceptable because it only gates a build-time error path (a variadic virtual with no bind_flat), never generated code. A concrete function type's display never contains ... for any other reason (all its parameter types are already instantiated).

Definition at line 82 of file document.hpp.

Referenced by render_trampoline().

◆ qualifier_tokens()

std::string welder::rods::trampolines::qualifier_tokens ( std::meta::info fn)
consteval

The trailing cv / ref-qualifier / noexcept tokens of a member function fn, in grammatical order (" const & noexcept"), each with a leading space.

Definition at line 89 of file document.hpp.

Referenced by render_trampoline().

◆ render_registration()

std::string welder::rods::trampolines::render_registration ( std::meta::info type)
consteval

The trampoline_for<type> specialization pointing at type's generated struct.

Definition at line 164 of file document.hpp.

References cpp_qualified_name(), generated_namespace, and trampoline_ident().

Referenced by welder::rods::trampolines::document::add().

◆ render_trampoline()

std::string welder::rods::trampolines::render_trampoline ( std::meta::info type)
consteval

Render the trampoline struct for welded virtual type type — one override per overridable virtual, each splicing the base's own reflected return/parameter types and forwarding to Python via WELDER_PY_OVERRIDE_AS (the slot-reflection form, so overloaded virtuals dispatch correctly).

Parameters
typea reflection of the welded virtual type.
Returns
the struct <ident> : <Base> { … }; text (no surrounding namespace).

Definition at line 115 of file document.hpp.

References cpp_qualified_name(), int_string(), is_c_variadic(), welder::rods::python::overridable_virtuals(), qualifier_tokens(), and trampoline_ident().

Referenced by welder::rods::trampolines::document::add().

◆ trampoline_ident()

std::string welder::rods::trampolines::trampoline_ident ( std::meta::info type)
consteval

A collision-free identifier for type's generated trampoline: its qualified name with :: folded to _ (geometry::Pointgeometry_Point_trampoline).

Definition at line 64 of file document.hpp.

Referenced by render_registration(), and render_trampoline().

Variable Documentation

◆ generated_namespace

const char* welder::rods::trampolines::generated_namespace
inlineconstexpr
Initial value:
{
"::welder::rods::trampolines::generated"}

The namespace the generated trampoline structs are emitted into (fully qualified).

Definition at line 105 of file document.hpp.

Referenced by render_registration().