|
Panini 1.4.0
Header-only library for generating C++, written in C++17
|
Writes output to a target file using a file stream. More...
#include <FileWriter.hpp>
Public Member Functions | |
| FileWriter (const FileWriterConfig &config={}) | |
| FileWriter (const std::filesystem::path &path, const WriterConfig &config=WriterConfig()) | |
| ~FileWriter () override | |
| bool | IsChanged () const override |
Public Member Functions inherited from panini::ConfiguredWriter< FileWriterConfig > | |
| ConfiguredWriter (const FileWriterConfig &config=FileWriterConfig {}) | |
| 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 |
| bool | Commit (bool force=false) override |
Public Member Functions inherited from panini::Writer | |
| virtual | ~Writer ()=default |
Protected Member Functions | |
| void | Write (const std::string &chunk) override |
| bool | OnCommit (bool force) override |
Protected Member Functions inherited from panini::ConfiguredWriter< FileWriterConfig > | |
| void | WriteNewLine () override |
Protected Attributes | |
| std::ofstream | m_target |
| std::string | m_written |
Protected Attributes inherited from panini::ConfiguredWriter< FileWriterConfig > | |
| FileWriterConfig | m_config |
Writes output to a target file using a file stream.
Unlike the CompareWriter, the FileWriter will always write to the target file regardless of whether the output has changed.
The file stream is closed when the writer is committed, which happens automatically when the writer is destroyed.
|
inline |
Construct and configure the writer.
| config | Configuration instance. |
|
inline |
Construct and configure the writer.
| path | Path to the target file. |
| config | Configuration instance. |
|
inlineoverride |
Will call Commit() automatically when the writer is destroyed.
|
inlineoverridevirtual |
Always close the stream when Commit is called.
Reimplemented from panini::ConfiguredWriter< FileWriterConfig >.
|
inlineoverrideprotectedvirtual |
Close the file stream when the writer is committed.
Implements panini::Writer.
|
inlineoverrideprotectedvirtual |
Writes the chunk to the file stream.
Implements panini::Writer.
|
protected |
|
protected |