Skip to content
Snippets Groups Projects
Commit 2fe61d04 authored by Sam Yates's avatar Sam Yates Committed by Ben Cumming
Browse files

Add custom streambuf for indented output. (#391)

These classes aim to provide an alternative to `TextBuffer` in `modcc` printers.

* Implement a streambuf wrapper `prefixbuf` that prepends a prefix string to each line.
* Adds stream manipulators `setprefix`, `indent`, `popindent`, `settab` for manipulating the prefix in a `prefixbuf`.
* Provide a wrapper stream `pfxstringstream` around `std::stringbuf` with `std::ostringstream` semantics.

As implemented, a prefix string set with the `setprefix` is applied to the underlying streambuf, and is not a property of the stream. This behaviour may be surprising, so consider storing this prefix with the stream as a possible enhancement.
parent 256c5421
No related branches found
No related tags found
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment