Output to stream with specified indent or prefix. More...
#include <indented-stream.hpp>
Public Member Functions | |
IndentedStream (std::ostream &os, const std::string &indent) | |
~IndentedStream () override | |
Output to stream with specified indent or prefix.
For example, the following code:
std::cout << "Hello" << std::endl; IndentedStream os1(std::cout, " [prefix] "); os1 << "," << "\n"; { IndentedStream os2(os1, " [another prefix] "); os2 << "World!" << "\n"; } // either os1 needs to go out of scope or call os1.flush()
Will produce the following output:
Hello [prefix] , [prefix] [another prefix] World!
Based on http://stackoverflow.com/a/2212940/2150331
Definition at line 54 of file indented-stream.hpp.
ndn::util::IndentedStream::IndentedStream | ( | std::ostream & | os, |
const std::string & | indent | ||
) |
Definition at line 33 of file indented-stream.cpp.
|
override |
Definition at line 39 of file indented-stream.cpp.