#pragma once #include #include #include namespace binparse { class treebuf : public std::streambuf { std::string prefix; std::streambuf* sbuf; bool need_prefix; int sync(); int overflow(int c); public: treebuf(std::streambuf* sbuf); void indent(); void unindent(); }; class otreestream : public virtual treebuf, public std::ostream { public: otreestream(std::ostream& out); }; class indent { treebuf& tb; public: indent(std::ostream& os); indent() = delete; indent(indent const&) = delete; indent(indent&&) = delete; indent& operator=(indent const&) = delete; indent& operator=(indent&&) = delete; ~indent(); }; }