27 #ifndef IDLFE_BE_INDENTEDOUT_H_
28 #define IDLFE_BE_INDENTEDOUT_H_
63 void open (
const std::filesystem::path& file);
89 return isbuf_.indentation ();
95 return isbuf_.last_char ();
99 size_t size () const noexcept
101 return isbuf_.size ();
105 class IndentedStreambuf :
public std::streambuf
108 IndentedStreambuf ();
110 void init (std::ostream& s);
111 void term (std::ostream& s);
120 assert (indentation_ > 0);
121 if (indentation_ > 0)
137 size_t size () const noexcept
143 virtual int overflow (
int c);
146 int put_char (
char c);
149 std::streambuf* out_;
150 unsigned indentation_;
157 IndentedStreambuf isbuf_;
Output file stream with indentation.
size_t size() const noexcept
~IndentedOut()
Destructor.
char last_char() const noexcept
void open(const std::filesystem::path &file)
Opens the file.
void empty_line()
Ensure that empty line inserted at the current position.
IndentedOut(const std::filesystem::path &file)
void indent() noexcept
Increase indentation.
void close()
Closes the file.
void unindent() noexcept
Decrease indentation.
IndentedOut()
Default constructor.
unsigned indentation() const noexcept
Back-end support utility classes.