Panini 1.4.0
Header-only library for generating C++, written in C++17
panini::CommentBlock Class Reference

Command for outputting comment blocks over multiple lines. More...

#include <CommentBlock.hpp>

Inheritance diagram for panini::CommentBlock:
panini::Command

Public Member Functions

 CommentBlock (std::function< void(Writer &)> &&callback) noexcept
 
void Visit (Writer &writer) override
 
- Public Member Functions inherited from panini::Command
virtual ~Command ()=default
 

Detailed Description

Command for outputting comment blocks over multiple lines.

A comment block starts with /‍* and ends with *‍/. Chunks output inside the callback are prefixed with " * " to produce multi-line comments.

You can still use other commands inside the comment block, including indentation. Note that the command adds a new line automatically.

Example:

writer << CommentBlock([](Writer& writer) {
writer << "EXAMPLE:" << NextLine();
writer << NextLine();
writer << "Writing beautiful multi-line comments is easy" << NextLine();
writer << "When you use a comment block command!";
});
CommentBlock(std::function< void(Writer &)> &&callback) noexcept
Definition: CommentBlock.hpp:77

Output:

/* EXAMPLE:
*
* Writing beautiful multi-line comments is easy
* When you use a comment block command!
*\/

Constructor & Destructor Documentation

◆ CommentBlock()

panini::CommentBlock::CommentBlock ( std::function< void(Writer &)> &&  callback)
inlineexplicitnoexcept

Construct a CommentBlock with a callback that is moved into the instance.

The callback is called when the command is visited by a Writer. Chunks output inside the callback will be prefixed with the C multi- line comment syntax.

Member Function Documentation

◆ Visit()

void panini::CommentBlock::Visit ( Writer writer)
inlineoverridevirtual

Accepts a Writer to write chunks to the output.

Implements panini::Command.


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