All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
util::details::IndentAdder< Stream > Class Template Reference

Stream wapper. More...

#include <StreamIndenter.h>

Public Member Functions

 IndentAdder (Stream &&out, std::string indent, std::string firstIndent)
 
 IndentAdder (Stream &out, std::string const &indent="")
 
template<typename T >
IndentAdderoperator<< (T &&value)
 

Private Member Functions

void streamOut ()
 

Private Attributes

Stream && fOut
 
std::string const fFirstIndent
 
std::string const fIndent
 
std::stringstream fSStr
 
std::string const * fCurrentIndent { &fFirstIndent }
 

Detailed Description

template<typename Stream>
class util::details::IndentAdder< Stream >

Stream wapper.

Definition at line 130 of file StreamIndenter.h.

Constructor & Destructor Documentation

template<typename Stream >
util::details::IndentAdder< Stream >::IndentAdder ( Stream &&  out,
std::string  indent,
std::string  firstIndent 
)
inline

Definition at line 140 of file StreamIndenter.h.

141  : fOut{ std::forward<Stream>(out) }
142  , fFirstIndent{ std::move(firstIndent) }, fIndent{ std::move(indent) }
143  {}
std::string const fFirstIndent
std::string const fIndent
template<typename Stream >
util::details::IndentAdder< Stream >::IndentAdder ( Stream out,
std::string const &  indent = "" 
)
inline

Definition at line 144 of file StreamIndenter.h.

145  : IndentAdder{ std::forward<Stream>(out), indent, indent } {}
IndentAdder(Stream &&out, std::string indent, std::string firstIndent)

Member Function Documentation

template<typename Stream >
template<typename T >
IndentAdder& util::details::IndentAdder< Stream >::operator<< ( T &&  value)
inline

Definition at line 148 of file StreamIndenter.h.

149  { fSStr << std::forward<T>(value); streamOut(); return *this; }
temporary value
template<typename Stream >
void util::details::IndentAdder< Stream >::streamOut ( )
inlineprivate

Definition at line 153 of file StreamIndenter.h.

154  {
155  bool newLine = true;
156  char ch;
157  while(fSStr.get(ch)) {
158  if (newLine) { fOut << *fCurrentIndent; fCurrentIndent = &fIndent; }
159  fOut << ch;
160  newLine = (ch == '\n');
161  } // while
162  fSStr.clear();
163  }
std::string const * fCurrentIndent
std::string const fIndent

Member Data Documentation

template<typename Stream >
std::string const* util::details::IndentAdder< Stream >::fCurrentIndent { &fFirstIndent }
private

Definition at line 137 of file StreamIndenter.h.

template<typename Stream >
std::string const util::details::IndentAdder< Stream >::fFirstIndent
private

Definition at line 133 of file StreamIndenter.h.

template<typename Stream >
std::string const util::details::IndentAdder< Stream >::fIndent
private

Definition at line 134 of file StreamIndenter.h.

template<typename Stream >
Stream&& util::details::IndentAdder< Stream >::fOut
private

Definition at line 132 of file StreamIndenter.h.

template<typename Stream >
std::stringstream util::details::IndentAdder< Stream >::fSStr
private

Definition at line 136 of file StreamIndenter.h.


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