Output to stream with specified indent or prefix. More...
#include <ndn-cxx/util/indented-stream.hpp>
Public Member Functions | |
IndentedStream (std::ostream &os, std::string_view 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 53 of file indented-stream.hpp.
ndn::util::IndentedStream::IndentedStream | ( | std::ostream & | os, |
std::string_view | indent | ||
) |
Definition at line 32 of file indented-stream.cpp.
|
override |
Definition at line 38 of file indented-stream.cpp.