Version: SMASH-3.1
einhard::OutputFormatter Class Reference

#include <einhard.hpp>

A wrapper for the output stream taking care proper formatting and colorization of the output.

Definition at line 276 of file einhard.hpp.

Inheritance diagram for einhard::OutputFormatter:
einhard::UnconditionalOutput

Public Member Functions

 OutputFormatter (const OutputFormatter &)=delete
 
 OutputFormatter (OutputFormatter &&)=default
 
template<LogLevel VERBOSITY>
EINHARD_ALWAYS_INLINE_ OutputFormatter (bool enabled_, bool const colorize_, const char *areaName, std::integral_constant< LogLevel, VERBOSITY >, std::FILE *outfile_=stdout)
 
template<typename T >
OutputFormatteroperator<< (const Color< T > &col)
 
EINHARD_ALWAYS_INLINE_ OutputFormatteroperator<< (std::ostream &(*manip)(std::ostream &))
 
template<typename T >
EINHARD_ALWAYS_INLINE_ OutputFormatteroperator<< (const T &msg)
 
EINHARD_ALWAYS_INLINE_ ~OutputFormatter ()
 
- Public Member Functions inherited from einhard::UnconditionalOutput
template<LogLevel VERBOSITY>
EINHARD_ALWAYS_INLINE_ UnconditionalOutput (bool colorize_, const char *areaName, std::integral_constant< LogLevel, VERBOSITY >)
 
template<typename T >
UnconditionalOutputoperator<< (const Color< T > &col)
 
EINHARD_ALWAYS_INLINE_ UnconditionalOutputoperator<< (std::ostream &(*manip)(std::ostream &))
 
template<typename T >
EINHARD_ALWAYS_INLINE_ UnconditionalOutputoperator<< (const T &msg)
 
void doCleanup (std::FILE *outfile=stdout) noexcept
 

Private Attributes

std::FILE *const outfile
 
const bool enabled
 

Additional Inherited Members

- Protected Member Functions inherited from einhard::UnconditionalOutput
EINHARD_ALWAYS_INLINE_ UnconditionalOutput (bool colorize_)
 
template<LogLevel VERBOSITY>
void doInit (const char *areaName)
 
void checkColorReset ()
 

Constructor & Destructor Documentation

◆ OutputFormatter() [1/3]

einhard::OutputFormatter::OutputFormatter ( const OutputFormatter )
delete

◆ OutputFormatter() [2/3]

einhard::OutputFormatter::OutputFormatter ( OutputFormatter &&  )
default

◆ OutputFormatter() [3/3]

template<LogLevel VERBOSITY>
EINHARD_ALWAYS_INLINE_ einhard::OutputFormatter::OutputFormatter ( bool  enabled_,
bool const  colorize_,
const char *  areaName,
std::integral_constant< LogLevel, VERBOSITY >  ,
std::FILE *  outfile_ = stdout 
)
inline

Definition at line 289 of file einhard.hpp.

293  : UnconditionalOutput( colorize_ ), enabled( enabled_ ), outfile( outfile_ )
294  {
295  if( enabled )
296  {
297  doInit<VERBOSITY>( areaName );
298  }
299  }
std::FILE *const outfile
Definition: einhard.hpp:280
EINHARD_ALWAYS_INLINE_ UnconditionalOutput(bool colorize_, const char *areaName, std::integral_constant< LogLevel, VERBOSITY >)
Definition: einhard.hpp:234

◆ ~OutputFormatter()

EINHARD_ALWAYS_INLINE_ einhard::OutputFormatter::~OutputFormatter ( )
inline

Definition at line 329 of file einhard.hpp.

330  {
331  if( enabled )
332  {
333  doCleanup( outfile );
334  }
335  }
void doCleanup(std::FILE *outfile=stdout) noexcept

Member Function Documentation

◆ operator<<() [1/3]

template<typename T >
OutputFormatter& einhard::OutputFormatter::operator<< ( const Color< T > &  col)
inline

Definition at line 301 of file einhard.hpp.

302  {
303  if( enabled )
304  {
306  }
307  return *this;
308  }
UnconditionalOutput & operator<<(const Color< T > &col)
Definition: einhard.hpp:241

◆ operator<<() [2/3]

EINHARD_ALWAYS_INLINE_ OutputFormatter& einhard::OutputFormatter::operator<< ( std::ostream &(*)(std::ostream &)  manip)
inline

Definition at line 310 of file einhard.hpp.

311  {
312  if( enabled )
313  {
315  }
316  return *this;
317  }

◆ operator<<() [3/3]

template<typename T >
EINHARD_ALWAYS_INLINE_ OutputFormatter& einhard::OutputFormatter::operator<< ( const T &  msg)
inline

Definition at line 319 of file einhard.hpp.

320  {
321  if( enabled )
322  {
324  }
325  return *this;
326  }

Member Data Documentation

◆ outfile

std::FILE* const einhard::OutputFormatter::outfile
private

Definition at line 280 of file einhard.hpp.

◆ enabled

const bool einhard::OutputFormatter::enabled
private

Definition at line 282 of file einhard.hpp.


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