|
Panini 1.4.0
Header-only library for generating C++, written in C++17
|
Command for outputting a scope with braces. More...
#include <Scope.hpp>
Public Types | |
| using | TCallback = std::function< void(Writer &writer)> |
Public Member Functions | |
| Scope (std::string &&name, TCallback &&callback, BraceBreakingStyle breakingStyle=BraceBreakingStyle::Inherit) noexcept | |
| Scope (const std::string &name, TCallback &&callback, BraceBreakingStyle breakingStyle=BraceBreakingStyle::Inherit) noexcept | |
| Scope (std::string &&name, TCallback &&callback, const ScopeOptions &options) noexcept | |
| Scope (const std::string &name, TCallback &&callback, const ScopeOptions &options) noexcept | |
| void | Visit (Writer &writer) override |
Public Member Functions inherited from panini::Command | |
| virtual | ~Command ()=default |
Command for outputting a scope with braces.
Scopes have a named chunk and use a Braces command to add opening and closing braces to the output.
Note that the command will automatically add a chunk between the name and the opening brace if the brace breaking style was set to BraceBreakingStyle::Attach by the writer or as an override for this command. This chunk can be configured with ScopeOptions.
Example:
Output:
| using panini::Scope::TCallback = std::function<void(Writer& writer)> |
Callback type used for conditions.
| writer | Active writer. |
|
inlineexplicitnoexcept |
Create a Scope with a name and a callback that are both moved into the instance.
The callback is called when the command is visited by a Writer.
Setting the breakingStyle parameter to BraceBreakingStyle::Inherit copies the brace breaking style from the writer, otherwise it will be overridden for this command only.
|
inlineexplicitnoexcept |
Create a Scope with a name that is copied and a callback that is moved into the instance.
The callback is called when the command is visited by a Writer.
Setting the breakingStyle parameter to BraceBreakingStyle::Inherit copies the brace breaking style from the writer, otherwise it will be overridden for this command only.
|
inlineexplicitnoexcept |
Create a Scope with a name and a callback that are both moved into the instance. options are used to configure the command instance.
|
inlineexplicitnoexcept |
Create a Scope with a name that is copied and a callback that is moved into the instance. options are used to configure the command instance.
|
inlineoverridevirtual |
Accepts a Writer to write chunks to the output.
Implements panini::Command.