Jpp 21.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
STREAM::JStream Struct Reference

Auxiliary class for format stream. More...

#include <JStreamAvailable.hh>

Public Member Functions

 JStream (std::ostream &out, const std::string &message)
 Constructor.
 
template<class T >
std::ostream & operator<< (const T &value)
 Write value to output stream.
 

Private Member Functions

template<class T >
std::ostream & print (std::ostream &out, const T &value, const std::true_type option)
 Print value if given option is true.
 
template<class T >
std::ostream & print (std::ostream &out, const T &value, const std::false_type option)
 Print value if given option is true.
 

Private Attributes

std::ostream & out
 
std::string message
 

Detailed Description

Auxiliary class for format stream.

Definition at line 40 of file JStreamAvailable.hh.

Constructor & Destructor Documentation

◆ JStream()

STREAM::JStream::JStream ( std::ostream & out,
const std::string & message )
inline

Constructor.

Parameters
outoutput stream
messagemessage printed in case operator std::ostream<< is unavailable

Definition at line 48 of file JStreamAvailable.hh.

48 :
49 out (out),
51 {}
std::ostream & out

Member Function Documentation

◆ operator<<()

template<class T >
std::ostream & STREAM::JStream::operator<< ( const T & value)
inline

Write value to output stream.

Parameters
valuevalue
Returns
this JStream

Definition at line 61 of file JStreamAvailable.hh.

62 {
63 return print(out, value, std::bool_constant<JStreamAvailable<T>::has_ostream>());
64 }
Test availability of stream operators.
std::ostream & print(std::ostream &out, const T &value, const std::true_type option)
Print value if given option is true.

◆ print() [1/2]

template<class T >
std::ostream & STREAM::JStream::print ( std::ostream & out,
const T & value,
const std::true_type option )
inlineprivate

Print value if given option is true.

Parameters
outoutput stream
valuevalue
optiontrue
Returns
output stream

Definition at line 76 of file JStreamAvailable.hh.

77 {
78 return out << value;
79 }

◆ print() [2/2]

template<class T >
std::ostream & STREAM::JStream::print ( std::ostream & out,
const T & value,
const std::false_type option )
inlineprivate

Print value if given option is true.

Parameters
outoutput stream
valuevalue
optionfalse
Returns
output stream

Definition at line 90 of file JStreamAvailable.hh.

91 {
92 return out << message;
93 }

Member Data Documentation

◆ out

std::ostream& STREAM::JStream::out
private

Definition at line 95 of file JStreamAvailable.hh.

◆ message

std::string STREAM::JStream::message
private

Definition at line 96 of file JStreamAvailable.hh.


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