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

NumPy-style docstring assembly (numpydoc). More...

#include <welder/rods/python/doc_style.hpp>

Static Public Member Functions

static constexpr std::string format (const ::welder::detail::function_doc &d)
 Assemble d into a NumPy-style docstring.
static constexpr std::string format_enum (const ::welder::detail::enum_doc &e)
 Assemble enum e into a NumPy-style docstring: the summary, then an underlined Attributes section listing each documented enumerator (the name on its own line, its doc indented four spaces beneath) — the numpydoc form for class/enum members.

Detailed Description

NumPy-style docstring assembly (numpydoc).

The summary, then an underlined Parameters section listing each documented parameter (the parameter name on its own line, its doc indented four spaces beneath), then an underlined Returns section (the return doc indented four spaces). welder has no target-language type text to place after the numpydoc name : type colon, so the type is omitted — a form numpydoc accepts (a bare name followed by an indented description). Empty sections are dropped and each section is preceded by a blank line; multiline docs keep their continuation lines under the four-space body indent.

Satisfies welder::doc_style. NumPy docstrings are also parsed by Sphinx's Napoleon extension.

Definition at line 164 of file doc_style.hpp.

Member Function Documentation

◆ format()

constexpr std::string welder::rods::python::numpy_style::format ( const ::welder::detail::function_doc & d)
inlinestaticconstexpr

Assemble d into a NumPy-style docstring.

Parameters
dthe documentation pieces.
Returns
the formatted docstring (possibly empty).

Definition at line 168 of file doc_style.hpp.

References welder::rods::python::detail::any_param_doc(), welder::rods::python::detail::append_indented(), and welder::rods::python::detail::blank_line().

◆ format_enum()

constexpr std::string welder::rods::python::numpy_style::format_enum ( const ::welder::detail::enum_doc & e)
inlinestaticconstexpr

Assemble enum e into a NumPy-style docstring: the summary, then an underlined Attributes section listing each documented enumerator (the name on its own line, its doc indented four spaces beneath) — the numpydoc form for class/enum members.

Empty when the enum carries no documentation at all.

Parameters
ethe enum documentation pieces.
Returns
the formatted docstring (possibly empty).

Definition at line 207 of file doc_style.hpp.

References welder::rods::python::detail::append_indented(), and welder::rods::python::detail::blank_line().


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