fmatvec  0.0.0
fmatvec::PrePostfixedStream Class Reference

#include <atom.h>

Inheritance diagram for fmatvec::PrePostfixedStream:
[legend]

Classes

class  StringBuf
 

Public Member Functions

 PrePostfixedStream (const std::string &prefix_, const std::string &postfix_, const std::function< void(const std::string &)> &outputFunc, const std::function< void(std::string &)> &escapingFunc=nullptr)
 Call f with every message of the stream, prefixed/postfixed.
 
 PrePostfixedStream (const std::string &prefix_, const std::string &postfix_, std::ostream &outstr_, const std::function< void(std::string &)> &escapingFunc=nullptr)
 Convinence function to print to outstr_.
 

Private Attributes

StringBuf buffer
 

Detailed Description

A ostream object which prefix/postfix every messasge. Before the output happens the message is converted using escapingFunc, if given. Then result is then passed to outputFunc of printed to outstr_ (dependent on the used ctor). The conversion using escapingFunc is skipped if the stream has set the skipws formatting flag, which is not set at the beginning. However, you have ALWAYS to call flush before skipws and to call flush and noskipws afterwards!!! But note that normally this is done by using disableEscaping and enableEscaping on the osyncstream of Atom::msg/Atom::msgStatic. (this flag is used since it is not relevant for a ostream and can hence be "misused" here).


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