welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
welder::detail::weld_as_spec< N > Struct Template Reference

The stored form of a weld_as annotation: a forced target-language name. More...

#include <welder/annotations.hpp>

Public Attributes

unsigned mask = 0
 The languages to rename for; 0 == all languages.
fixed_string< N > name
 The verbatim target-language name.

Detailed Description

template<size_type N>
struct welder::detail::weld_as_spec< N >

The stored form of a weld_as annotation: a forced target-language name.

Where a code-style transformer (see <welder/naming.hpp>) reshapes an entity's C++ identifier into the target language's convention, weld_as is the ultimate override — the string is used verbatim, bypassing the transformer entirely. The name is always the last argument; any languages naming it come first. Give no language and it covers all of them; give one or several to scope it, and repeat the annotation to use a different name per language — so a member can read process in Python and Process in Lua at once:

[[=welder::weld_as("id")]] // every language
[[=welder::weld_as(welder::lang::py, "id")]] // Python only
consteval detail::weld_as_spec< N > weld_as(const char(&s)[N])
Force s as the target name in every welded language.
@ py
Python (via the pybind11 and nanobind backends).
Definition lang.hpp:43
@ lua
Lua (via the sol2 and LuaBridge3 backends).
Definition lang.hpp:44

The name is captured inline (a fixed_string), like doc, so it can live in a structural annotation constant.

Template Parameters
Nthe name length including the terminator (deduced).

Definition at line 336 of file annotations.hpp.

Member Data Documentation

◆ mask

template<size_type N>
unsigned welder::detail::weld_as_spec< N >::mask = 0

The languages to rename for; 0 == all languages.

Definition at line 337 of file annotations.hpp.

◆ name

The verbatim target-language name.

Definition at line 338 of file annotations.hpp.


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