|
Panini 1.4.0
Header-only library for generating C++, written in C++17
|
Base class implementation for writers. More...
#include <Writer.hpp>
Public Member Functions | |
| ConfiguredWriter (const TConfig &config=TConfig{}) | |
| virtual | ~ConfiguredWriter ()=default |
| const WriterConfig & | GetConfig () const override |
| BraceBreakingStyle | GetBraceBreakingStyle () const override |
| IncludeStyle | GetIncludeStyle () const override |
| bool | IsOnNewLine () const override |
| Writer & | operator<< (const std::string &chunk) override |
| Writer & | operator<< (const char *chunkString) override |
| Writer & | operator<< (const NextLine &command) override |
| Writer & | operator<< (const IndentPush &command) override |
| Writer & | operator<< (const IndentPop &command) override |
| Writer & | operator<< (Command &&command) override |
| void | SetIsInCommentBlock (bool value) override |
| virtual bool | IsChanged () const override |
| bool | Commit (bool force=false) override |
Public Member Functions inherited from panini::Writer | |
| virtual | ~Writer ()=default |
Protected Member Functions | |
| void | WriteNewLine () override |
Protected Member Functions inherited from panini::Writer | |
| virtual void | Write (const std::string &chunk)=0 |
| virtual bool | OnCommit (bool force=false)=0 |
Protected Attributes | |
| TConfig | m_config |
Base class implementation for writers.
When making your own writer, you should inherit from this class and supply a config struct that inherits from WriterConfig.
|
inlineexplicit |
Constructs a writer with an optional configuration instance.
|
virtualdefault |
|
inlineoverridevirtual |
Commits the generated output to the target of a writer if the output was changed.
| force | Force writing the file even if the output was not changed. |
Implements panini::Writer.
|
inlineoverridevirtual |
Get the default brace breaking style.
Implements panini::Writer.
|
inlineoverridevirtual |
Get a reference to the active WriterConfig for this writer.
Implements panini::Writer.
|
inlineoverridevirtual |
Get the default include style.
Implements panini::Writer.
|
inlineoverridevirtual |
Check if the output was changed compared to what the implementation has seen before.
Implements panini::Writer.
Reimplemented in panini::CompareWriter, panini::DebugWriter, and panini::FileWriter.
|
inlineoverridevirtual |
Check whether the writer is on a new line and waiting for new chunks.
Implements panini::Writer.
|
inlineoverridevirtual |
Visit a command.
Commands are used to output chunks and modify the writer's state.
Implements panini::Writer.
|
inlineoverridevirtual |
Write a C-style string chunk to the output.
Will add indentation if the writer is on a new line.
Implements panini::Writer.
|
inlineoverridevirtual |
Decrement the level of indentation.
Indentation is applied when the writer is on a new line. The level of indentation cannot go negative.
Implements panini::Writer.
|
inlineoverridevirtual |
Increment the level of indentation.
Indentation is applied only when the writer is on a new line.
Implements panini::Writer.
|
inlineoverridevirtual |
Write a new line chunk to the output.
New line chunks can be configured with the Config.
Implements panini::Writer.
|
inlineoverridevirtual |
Write an std::string chunk to the output.
Will add indentation if the writer is on a new line.
Implements panini::Writer.
|
inlineoverridevirtual |
Set the writer to be inside a comment block, which will add " * " after the indentation of a new line.
Implements panini::Writer.
|
inlineoverrideprotectedvirtual |
Writes a new line chunk to the output.
Implements panini::Writer.
|
protected |