26 #include <boost/range/iterator_range.hpp> 27 #include <boost/algorithm/string/split.hpp> 28 #include <boost/algorithm/string/classification.hpp> 34 :
std::ostream(&m_buffer)
35 , m_buffer(os, indent)
44 IndentedStream::StreamBuf::StreamBuf(std::ostream& os,
const std::string& indent)
51 IndentedStream::StreamBuf::sync()
53 typedef boost::iterator_range<std::string::const_iterator> StringView;
55 const std::string& output = str();
56 std::vector<StringView> splitOutput;
57 boost::split(splitOutput, output, boost::is_any_of(
"\n"));
59 if (!splitOutput.empty() && splitOutput.back().empty()) {
60 splitOutput.pop_back();
62 for (
const StringView& line : splitOutput) {
63 m_output << m_indent << line <<
"\n";
Copyright (c) 2013-2017 Regents of the University of California.
~IndentedStream() override
IndentedStream(std::ostream &os, const std::string &indent)