NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::util::IndentedStream Class Reference

Output to stream with specified indent or prefix. More...

#include <indented-stream.hpp>

Inheritance diagram for ndn::util::IndentedStream:
Collaboration diagram for ndn::util::IndentedStream:

Public Member Functions

 IndentedStream (std::ostream &os, const std::string &indent)
 ~IndentedStream () override

Detailed Description

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:

 [prefix] ,
 [prefix] [another prefix] World!

Based on http://stackoverflow.com/a/2212940/2150331

Definition at line 54 of file indented-stream.hpp.

Constructor & Destructor Documentation

◆ IndentedStream()

ndn::util::IndentedStream::IndentedStream ( std::ostream &  os,
const std::string &  indent 

Definition at line 33 of file indented-stream.cpp.

◆ ~IndentedStream()

ndn::util::IndentedStream::~IndentedStream ( )

Definition at line 39 of file indented-stream.cpp.

The documentation for this class was generated from the following files: