|
Panini 1.4.0
Header-only library for generating C++, written in C++17
|
Pure virtual interface for writers. More...
#include <Writer.hpp>
Public Member Functions | |
| virtual | ~Writer ()=default |
| virtual const WriterConfig & | GetConfig () const =0 |
| virtual BraceBreakingStyle | GetBraceBreakingStyle () const =0 |
| virtual IncludeStyle | GetIncludeStyle () const =0 |
| virtual bool | IsOnNewLine () const =0 |
| virtual Writer & | operator<< (const std::string &chunk)=0 |
| virtual Writer & | operator<< (const char *chunkString)=0 |
| virtual Writer & | operator<< (const NextLine &command)=0 |
| virtual Writer & | operator<< (const IndentPush &command)=0 |
| virtual Writer & | operator<< (const IndentPop &command)=0 |
| virtual Writer & | operator<< (Command &&command)=0 |
| virtual void | SetIsInCommentBlock (bool value)=0 |
| virtual bool | IsChanged () const =0 |
| virtual bool | Commit (bool force)=0 |
Protected Member Functions | |
| virtual void | Write (const std::string &chunk)=0 |
| virtual void | WriteNewLine ()=0 |
| virtual bool | OnCommit (bool force=false)=0 |
Pure virtual interface for writers.
Writers take chunks and commands as input and process them to a target. They are configured with a Config instance that is passed to their constructor.
Writers commit their output to a target automatically when they are destroyed.
|
virtualdefault |
|
pure virtual |
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. |
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Get the default brace breaking style.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Get a reference to the active Config for this writer.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Get the default include style.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Check if the output was changed compared to what the implementation has seen before.
Implemented in panini::CompareWriter, panini::DebugWriter, panini::FileWriter, panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Check whether the writer is on a new line and waiting for new chunks.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
protectedpure virtual |
Checks if the writer should commit its output to the target.
Implemented in panini::ConsoleWriter, panini::FileWriter, panini::StringWriter, panini::CompareWriter, and panini::DebugWriter.
Visit a command.
Commands are used to output chunks and modify the writer's state.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Write a C-style string chunk to the output.
Will add indentation if the writer is on a new line.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
Decrement the level of indentation.
Indentation is applied when the writer is on a new line. The level of indentation cannot go negative.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Increment the level of indentation.
Indentation is applied only when the writer is on a new line.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
Write a new line chunk to the output.
New line chunks can be configured with the Config.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Write an std::string chunk to the output.
Will add indentation if the writer is on a new line.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
pure virtual |
Set the writer to be inside a comment block, which will add " * " after the indentation of a new line.
Implemented in panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.
|
protectedpure virtual |
Writes chunks to the output.
Implemented in panini::CompareWriter, panini::ConsoleWriter, panini::DebugWriter, panini::FileWriter, and panini::StringWriter.
|
protectedpure virtual |
Writes a new line chunk to the output.
Implemented in panini::ConsoleWriter, panini::DebugWriter, panini::ConfiguredWriter< TConfig >, panini::ConfiguredWriter< CompareWriterConfig >, panini::ConfiguredWriter< ConsoleWriterConfig >, panini::ConfiguredWriter< DebugWriterConfig >, panini::ConfiguredWriter< FileWriterConfig >, and panini::ConfiguredWriter< StringWriterConfig >.