5 #ifndef FORBCC_CODE_OSSTREAM_H 6 #define FORBCC_CODE_OSSTREAM_H 19 class code_stringbuf :
public std::stringbuf {
31 explicit code_stringbuf(std::ostream &output) : output(output) {};
36 code_stringbuf(code_stringbuf &&) =
default;
39 code_stringbuf &
operator=(code_stringbuf &&) =
delete;
42 code_stringbuf(
const code_stringbuf &) =
delete;
45 code_stringbuf &
operator=(
const code_stringbuf &) =
delete;
50 ~code_stringbuf()
override {
51 if (pbase() != pptr()) {
81 code_stringbuf buffer;
87 explicit code_ostream(std::ostream &output) : std::ostream(&buffer), buffer(output) {};
118 #endif //FORBCC_CODE_OSSTREAM_H void increment_indentation()
Proxy to code_ostream::code_stringbuf::increment_indentation.
Definition: code_ostream.hpp:109
~code_ostream() override=default
This class is virtual, so it requires a virtual destructor.
void decrement_indentation()
Proxy to code_ostream::code_stringbuf::decrement_indentation.
Definition: code_ostream.hpp:112
This output stream supports indentation of code lines, which are formatted at each std::endl...
Definition: code_ostream.hpp:14
Definition: code_ostream.hpp:11
code_ostream & operator=(code_ostream &&)=delete
This class does not support move-assignment.
code_ostream(std::ostream &output)
Creates a new code_ostream starting from the given one.
Definition: code_ostream.hpp:87