welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
type_map.hpp File Reference

The low-level rendering primitives of the LuaCATS stub backend: the C++→LuaCATS type map**, the C++-operator → ---@operator name map, the "native" caster trait, and the small text helpers the document assembler (<welder/rods/lua/luacats/document.hpp>) and the backend share. More...

#include <cstddef>
#include <meta>
#include <string>
#include <string_view>
#include <type_traits>
#include <vector>
#include <welder/bind_traits.hpp>
#include <welder/bindable.hpp>
Include dependency graph for type_map.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  welder
namespace  welder::rods
namespace  welder::rods::luacats

Functions

void welder::rods::luacats::emit_doc_comment (std::string &out, const char *text)
 Append text as --- comment lines (each source line prefixed), so a multiline summary lands as a LuaCATS description block.
std::string welder::rods::luacats::one_line (const char *text)
 A one-line description for a @field/@param/@return tail: newlines in text collapse to spaces (LuaCATS tags are single-line).
consteval std::string welder::rods::luacats::qualified_name (std::meta::info ent)
 The dotted LuaCATS name of a namespace-or-type reflection: its own identifier prefixed by each enclosing named namespace and enclosing class (a nested type binds under its outer's table), dot-joined — so geometry::Point"geometry.Point" and geometry::Robot::Sensor"geometry.Robot.Sensor".
consteval bool welder::rods::luacats::type_trait (std::meta::info trait_var, std::meta::info t)
 Evaluate a standard unary type-trait variable template (e.g.
consteval bool welder::rods::luacats::is_wrapper (std::meta::info type, std::meta::info &tmpl_out)
 Whether type (already a bare type) is a listed element-wise wrapper whose LuaCATS spelling this map renders.
consteval std::string welder::rods::luacats::lua_type_string (std::meta::info type)
 The LuaCATS type name for a C++ type reflection.
consteval const char * welder::rods::luacats::lua_type (std::meta::info type)
 lua_type_string as a static-storage C string, callable on a constant type reflection.
consteval const char * welder::rods::luacats::operator_luacats (std::meta::info f)
 A member operator's LuaCATS ---@operator name, or nullptr if not rendered.

Variables

template<class U>
constexpr bool welder::rods::luacats::is_native_lua
 Whether the backend converts U without welder registering a type: scalars, strings and char*.

Detailed Description

The low-level rendering primitives of the LuaCATS stub backend: the C++→LuaCATS type map**, the C++-operator → ---@operator name map, the "native" caster trait, and the small text helpers the document assembler (<welder/rods/lua/luacats/document.hpp>) and the backend share.

The runtime sol2 backend only needed a yes/no caster oracle; a stub needs the actual LuaCATS type name for every C++ type, which is the one thing living here that sol2 did not require. Kept separate from the backend so the type map and the document assembler read as distinct layers rather than one soup.

Requires the welder vocabulary first (#include <welder/vocabulary.hpp>), like the rest of the reflection layer.

Definition in file type_map.hpp.