|
welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
|
Classes | |
| struct | document |
| The accumulator threaded through the rod's emission hooks: the deduped set of reference containers the welded namespace uses, and the renderer for the finished header. More... | |
| struct | entry |
| One container to open opaque: its C++ spelling, its derived target name, and whether a by_value mark excluded it (kept in the set so a later use site can be reconciled, but skipped at render). More... | |
| struct | rod |
| The opaque-container generator rod (satisfies welder::rod). More... | |
Functions | |
| consteval std::string | container_spelling (std::meta::info type) |
| The C++ text of container type, infrastructure args (allocator/comparator/ hasher) dropped — the reflection display form, which already elides them (std::vector<int>, std::map<std::__cxx11::basic_string<char>, int>). | |
| consteval std::size_t | value_arg_count (std::meta::info type) |
| How many leading (value) template arguments of type name its element/key/value types — a sequence exposes 1, a map 2. | |
| consteval std::string | sanitize_ident (std::string s) |
| Reduce s to a valid C++ identifier: keep [A-Za-z0-9_], collapse every other run to a single _ (dropping leading/trailing ones), and prefix _ if it would start with a digit. | |
| consteval std::string | qualified_ident (std::meta::info entity) |
| The collision-free qualified identifier of entity: its own identifier (or, for an unnameable entity, its display_string_of) prefixed by every enclosing named namespace and enclosing class, each PascalCased and concatenated — so a type is named uniquely across namespaces (geometry::Point → GeometryPoint, physics::Point → PhysicsPoint, never a colliding bare Point). | |
| consteval std::string | derive_name (std::meta::info arg) |
| A readable, valid, collision-free PascalCase identifier for container/element arg — the template name plus each argument's name, recursing — vector<int> → VectorInt, map<string,int> → MapStringInt, nested map<string,vector<int>> → MapStringVectorInt. | |
| consteval bool | has_opaque_hook (std::meta::info style_type) |
| Does name style style_type (or any of its bases) declare the optional transform_opaque_container hook? | |
| template<class Style, std::meta::info Enclosing, std::meta::info Container, std::meta::info Member> | |
| consteval std::string | opaque_name () |
| The opaque-wrapper name for container Container found on member/site Member within Enclosing — the customization point behind the generator's naming. | |
| consteval std::string | namespace_name (std::meta::info ns) |
| The fully-qualified spelling of namespace ns for a namespace X { … } header block (no leading :: — geometry::detail, not ::geometry::detail). | |
| consteval bool | scalar_leaf (std::meta::info t) |
| Is t a scalar leaf — a fundamental type or a std::basic_string — i.e. | |
| consteval bool | element_ok (std::meta::info t) |
| Can the driver's PHASE 1 (name pre-registration) register t's name before PHASE 2 binds the container that uses it — i.e. | |
| consteval bool | opaque_eligible (std::meta::info type) |
| Is container type eligible for the generator — will PHASE 1 register every element/key/value type's name before PHASE 2 binds it (see element_ok)? | |
| consteval void | collect_into (std::vector< std::meta::info > &out, std::meta::info type) |
| Append type's directly-named reference container when it is one and eligible (see opaque_eligible). | |
| template<std::meta::info Type> | |
| consteval std::vector< std::meta::info > | containers_in () |
| The reference containers within surface type Type (a splice-ready static list for a template for). | |
|
consteval |
Append type's directly-named reference container when it is one and eligible (see opaque_eligible).
cv/ref-stripped like the bindability gate; non-eligible (welded-class-element or nested) containers, and non-container wrappers (optional, pair), are left by value.
| out | the accumulator. |
| type | a surface (member/param/return) type. |
Definition at line 273 of file document.hpp.
References welder::is_reference_container(), and opaque_eligible().
Referenced by containers_in().
|
consteval |
The C++ text of container type, infrastructure args (allocator/comparator/ hasher) dropped — the reflection display form, which already elides them (std::vector<int>, std::map<std::__cxx11::basic_string<char>, int>).
Valid, include-order-robust C++ for a WELDER_OPAQUE(...) / alias right-hand side.
Definition at line 36 of file document.hpp.
Referenced by welder::rods::opaque_containers::document::add_one().
|
consteval |
The reference containers within surface type Type (a splice-ready static list for a template for).
Definition at line 282 of file document.hpp.
References collect_into().
Referenced by welder::rods::opaque_containers::document::collect().
|
consteval |
A readable, valid, collision-free PascalCase identifier for container/element arg — the template name plus each argument's name, recursing — vector<int> → VectorInt, map<string,int> → MapStringInt, nested map<string,vector<int>> → MapStringVectorInt.
std::string folds to String; a scalar / welded class or enum uses its qualified_ident (namespace- and enclosing-class-qualified, so geometry::Point → GeometryPoint) — which is what keeps distinct types from deriving the same name.
A container element that is itself a class-template specialization (e.g. WMOGroup<ClientVersion{3,3,5,12340}>) recurses the SAME way — the template name plus each argument — so it never falls to display_string_of, which would keep :: < > { } ,. A non-type (NTTP) argument renders its value as a sanitized identifier token. The caller (document::add_one) sanitizes the final string as a safety net, so no input can yield a non-identifier.
Definition at line 134 of file document.hpp.
References derive_name(), welder::is_reference_container(), qualified_ident(), and value_arg_count().
Referenced by derive_name(), and opaque_name().
|
consteval |
Can the driver's PHASE 1 (name pre-registration) register t's name before PHASE 2 binds the container that uses it — i.e.
is t either a scalar leaf, or a top-level** welded class/enum (a weld_namespace sweep predeclares those names first)?
A NESTED (class-scoped) welded type is bound inside its enclosing class's interior in PHASE 3, after the containers, so it is NOT predeclared — a vector<Outer::Inner> would spell Inner's raw C++ name in the container's stub. A nested container (vector<vector<int>>) is likewise unsafe (the inner container is a PHASE-2 binding, not a predeclared name). Both are excluded; hand-write their alias.
Definition at line 241 of file document.hpp.
References welder::is_reference_container(), welder::py, scalar_leaf(), and welder::welded_for().
Referenced by opaque_eligible().
|
consteval |
Does name style style_type (or any of its bases) declare the optional transform_opaque_container hook?
Detected by reflection rather than a requires-expression because the hook is a consteval static member — an immediate call cannot appear in the unevaluated operand of a requires, so a concept check would silently miss it.
Definition at line 170 of file document.hpp.
References has_opaque_hook().
Referenced by has_opaque_hook(), and opaque_name().
|
consteval |
The fully-qualified spelling of namespace ns for a namespace X { … } header block (no leading :: — geometry::detail, not ::geometry::detail).
Definition at line 210 of file document.hpp.
Referenced by welder::rods::opaque_containers::rod::generate().
|
consteval |
Is container type eligible for the generator — will PHASE 1 register every element/key/value type's name before PHASE 2 binds it (see element_ok)?
The generator opens scalar-element AND welded-class/enum-element containers (the common std::vector<Entity> case); only nested-in-class element types and nested containers are left by value.
Definition at line 260 of file document.hpp.
References element_ok(), and value_arg_count().
Referenced by collect_into().
|
consteval |
The opaque-wrapper name for container Container found on member/site Member within Enclosing — the customization point behind the generator's naming.
By default this is the collision-free derive_name of the container type. A name style Style may override it by providing an (optional) hook
— a style with no such hook (every stock welder::naming style) falls straight through to derive_name. The result is run through sanitize_ident either way, so a hook can never yield a non-identifier. Because opaque wrappers are deduped per container type** (module-wide), the hook is honoured at the container's first Style-aware use site; Enclosing / Member are that site's context.
Definition at line 200 of file document.hpp.
References derive_name(), has_opaque_hook(), and sanitize_ident().
Referenced by welder::rods::opaque_containers::document::add_one().
|
consteval |
The collision-free qualified identifier of entity: its own identifier (or, for an unnameable entity, its display_string_of) prefixed by every enclosing named namespace and enclosing class, each PascalCased and concatenated — so a type is named uniquely across namespaces (geometry::Point → GeometryPoint, physics::Point → PhysicsPoint, never a colliding bare Point).
The global namespace, an anonymous namespace, the std namespace, and an implementation-reserved (__-prefixed, e.g. std::__cxx11) inline namespace each contribute nothing — so a std:: container/element still reads clean (std::vector → Vector, std::string folds to String before this is reached). This is what makes two same-named types in different namespaces derive distinct opaque-wrapper names without a weld_as (the render-time #error in document::render remains only as a last-resort backstop). Reuses welder::naming::restyle.
Definition at line 86 of file document.hpp.
References welder::naming::pascal, and welder::naming::restyle().
Referenced by derive_name().
|
consteval |
Reduce s to a valid C++ identifier: keep [A-Za-z0-9_], collapse every other run to a single _ (dropping leading/trailing ones), and prefix _ if it would start with a digit.
The generator's last-resort guarantee that no input — however exotic its display_string_of — can produce an uncompilable alias name.
Definition at line 50 of file document.hpp.
Referenced by opaque_name().
|
consteval |
Is t a scalar leaf — a fundamental type or a std::basic_string — i.e.
one that needs no class registration of its own?
Definition at line 223 of file document.hpp.
Referenced by element_ok().
|
consteval |
How many leading (value) template arguments of type name its element/key/value types — a sequence exposes 1, a map 2.
Definition at line 42 of file document.hpp.
References welder::map.
Referenced by derive_name(), and opaque_eligible().