26 #include <boost/range/iterator_range.hpp>
27 #include <boost/algorithm/string/split.hpp>
28 #include <boost/algorithm/string/classification.hpp>
33 : std::ostream(&m_buffer)
34 , m_buffer(os, indent)
43 IndentedStream::StreamBuf::StreamBuf(std::ostream& os, std::string_view indent)
50 IndentedStream::StreamBuf::sync()
52 using StringView = boost::iterator_range<std::string::const_iterator>;
54 std::string output = str();
55 std::vector<StringView> splitOutput;
56 boost::split(splitOutput, output, boost::is_any_of(
"\n"));
58 if (!splitOutput.empty() && splitOutput.back().empty()) {
59 splitOutput.pop_back();
61 for (
const StringView& line : splitOutput) {
62 m_output << m_indent << line <<
"\n";
~IndentedStream() override
IndentedStream(std::ostream &os, std::string_view indent)