|
welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
|
Functions | |
| constexpr void | append_indented (std::string &out, const char *text, std::string_view indent) |
| Append text to out, indenting every continuation line by indent so a multiline param/returns doc stays visually under its block (docs often carry examples spanning lines). | |
| constexpr void | blank_line (std::string &out) |
| Separate a new block from preceding content in out by exactly one blank line, whether or not that content already ended in a newline (a summary does not; a section body typically does). | |
| constexpr bool | any_param_doc (const ::welder::detail::function_doc &d) |
| Whether d has at least one documented parameter (so a params block is worth opening). | |
| consteval bool | same_slot (std::meta::info a, std::meta::info b) |
| Do a and b declare the same vtable slot? | |
| consteval void | collect_virtuals (std::meta::info type, std::vector< std::meta::info > &slots) |
| Accumulate the most-derived declaration of every virtual member function reachable in type's complete object into slots, deduplicating by vtable slot (same_slot — name + parameters + cv/ref, so a covariant override is one slot, not two). | |
|
constexpr |
Whether d has at least one documented parameter (so a params block is worth opening).
An undocumented parameter contributes nothing to any style.
Definition at line 70 of file doc_style.hpp.
Referenced by welder::rods::python::google_style::format(), welder::rods::python::numpy_style::format(), and welder::rods::python::sphinx_style::format().
|
constexpr |
Append text to out, indenting every continuation line by indent so a multiline param/returns doc stays visually under its block (docs often carry examples spanning lines).
A trailing newline gets no indent, so no dangling whitespace line is left. Shared by all three Python styles.
Definition at line 48 of file doc_style.hpp.
Referenced by welder::rods::python::google_style::format(), welder::rods::python::numpy_style::format(), and welder::rods::python::sphinx_style::format().
|
constexpr |
Separate a new block from preceding content in out by exactly one blank line, whether or not that content already ended in a newline (a summary does not; a section body typically does).
A no-op when out is still empty.
Definition at line 60 of file doc_style.hpp.
Referenced by welder::rods::python::google_style::format(), welder::rods::python::numpy_style::format(), and welder::rods::python::sphinx_style::format().
|
consteval |
Accumulate the most-derived declaration of every virtual member function reachable in type's complete object into slots, deduplicating by vtable slot (same_slot — name + parameters + cv/ref, so a covariant override is one slot, not two).
members_of lists a class's own members only, so a virtual a subclass merely inherits is invisible there — the reason a whole-hierarchy walk is needed. type's own members are visited before its bases, so the first declaration recorded for a given slot is the most-derived one; a base's re-declaration of an already-seen slot is skipped. Members are enumerated with access_context::unchecked() (like the rest of welder's core): a protected virtual — the NVI/template-method hook — is a real overridable slot even though it is never bound (Python overrides it via attribute lookup, which needs no binding). Neither bind_flat nor access is filtered here — a private declaration still claims its slot in the dedup, and the filters are applied by overridable_virtuals on the kept most-derived declaration. So a subclass can un-flatten a virtual its base marked bind_flat (and vice versa), and privatizing an inherited virtual withdraws the slot rather than resurrecting the base's public declaration.
| type | a reflection of the class type. |
| slots | the accumulator of most-derived virtual declarations. |
Definition at line 237 of file trampoline.hpp.
References collect_virtuals(), and same_slot().
Referenced by collect_virtuals(), and welder::rods::python::overridable_virtuals().
|
consteval |
Do a and b declare the same vtable slot?
Slot identity is the name plus everything overriding keys off: the parameter types and the cv / ref qualifiers. The return type is deliberately excluded — a covariant override (Derived* clone() over Base* clone()) redeclares the same slot with a narrower return, and comparing full type_of would count it as a second slot. noexcept is excluded for the same reason: an override may strengthen* the exception specification, and two overloads cannot differ by noexcept alone, so it can never distinguish genuine slots.
Definition at line 196 of file trampoline.hpp.
Referenced by collect_virtuals().