DGtal 1.3.0
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions
DGtal::TraceWriterTerm Class Reference

Implements trace prefix for color terminals. More...

#include <DGtal/base/TraceWriterTerm.h>

Inheritance diagram for DGtal::TraceWriterTerm:
DGtal::TraceWriter

Public Member Functions

 TraceWriterTerm (std::ostream &aoutputStream=std::cerr)
 
 ~TraceWriterTerm ()
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string prefixWarning ()
 
std::string prefixInfo ()
 
std::string prefixError ()
 
std::string prefixEmphase ()
 
std::string postfixReset ()
 
- Public Member Functions inherited from DGtal::TraceWriter
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
virtual std::string prefixWarning ()=0
 
virtual std::string prefixInfo ()=0
 
virtual std::string prefixError ()=0
 
virtual std::string prefixEmphase ()=0
 
virtual std::string postfixReset ()=0
 
std::ostream & outputStream ()
 

Private Member Functions

 TraceWriterTerm (const TraceWriterTerm &other)
 
TraceWriterTermoperator= (const TraceWriterTerm &other)
 

Additional Inherited Members

- Protected Member Functions inherited from DGtal::TraceWriter
 TraceWriter (std::ostream &aoutputStream)
 
- Protected Attributes inherited from DGtal::TraceWriter
std::ostream & myOutputStream
 Reference to the output stream. More...
 

Detailed Description

Implements trace prefix for color terminals.

Description of class 'TraceWriterTerm'

Aim:

Todo:
Detect if the terminal has color capabilities
See also
testTrace.cpp

Definition at line 63 of file TraceWriterTerm.h.

Constructor & Destructor Documentation

◆ TraceWriterTerm() [1/2]

DGtal::TraceWriterTerm::TraceWriterTerm ( std::ostream &  aoutputStream = std::cerr)
inline

Constructor.

Parameters
aoutputStreamthe current output Stream

Definition at line 72 of file TraceWriterTerm.h.

72: TraceWriter(aoutputStream) {};
TraceWriter(std::ostream &aoutputStream)
Definition: TraceWriter.h:103

◆ ~TraceWriterTerm()

DGtal::TraceWriterTerm::~TraceWriterTerm ( )
inline

Destructor.

Definition at line 78 of file TraceWriterTerm.h.

78{};

◆ TraceWriterTerm() [2/2]

DGtal::TraceWriterTerm::TraceWriterTerm ( const TraceWriterTerm other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

◆ isValid()

bool DGtal::TraceWriterTerm::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ operator=()

TraceWriterTerm & DGtal::TraceWriterTerm::operator= ( const TraceWriterTerm other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.

◆ postfixReset()

std::string DGtal::TraceWriterTerm::postfixReset ( )
inlinevirtual

Create a Reset postfix

Returns
the postfix

Implements DGtal::TraceWriter.

Definition at line 153 of file TraceWriterTerm.h.

154 {
155#if ( !defined(DGTAL_NO_ESCAPED_CHAR_IN_TRACE) && (defined(UNIX)||defined(unix)||defined(linux)) )
156 return "\033[0m";
157#else
158 return "";
159#endif
160 }

◆ prefixEmphase()

std::string DGtal::TraceWriterTerm::prefixEmphase ( )
inlinevirtual

Create an Emphase Prefix

Returns
the prefix

Implements DGtal::TraceWriter.

Definition at line 140 of file TraceWriterTerm.h.

141 {
142#if ( !defined(DGTAL_NO_ESCAPED_CHAR_IN_TRACE) && (defined(UNIX)||defined(unix)||defined(linux)) )
143 return "\033[0m\033[1m";
144#else
145 return "";
146#endif
147 }

◆ prefixError()

std::string DGtal::TraceWriterTerm::prefixError ( )
inlinevirtual

Create an Error Prefix

Returns
the prefix

Implements DGtal::TraceWriter.

Definition at line 127 of file TraceWriterTerm.h.

128 {
129#if ( !defined(DGTAL_NO_ESCAPED_CHAR_IN_TRACE) && (defined(UNIX)||defined(unix)||defined(linux)) )
130 return "\033[0m\033[31m[ERR]";
131#else
132 return "";
133#endif
134 }

◆ prefixInfo()

std::string DGtal::TraceWriterTerm::prefixInfo ( )
inlinevirtual

Create an Info Prefix

Returns
the prefix

Implements DGtal::TraceWriter.

Definition at line 114 of file TraceWriterTerm.h.

115 {
116#if ( !defined(DGTAL_NO_ESCAPED_CHAR_IN_TRACE) && (defined(UNIX)||defined(unix)||defined(linux)) )
117 return "\033[0m";
118#else
119 return "";
120#endif
121 }

◆ prefixWarning()

std::string DGtal::TraceWriterTerm::prefixWarning ( )
inlinevirtual

Create a Wrarning Prefix

Returns
the prefix

Implements DGtal::TraceWriter.

Definition at line 101 of file TraceWriterTerm.h.

102 {
103#if ( !defined(DGTAL_NO_ESCAPED_CHAR_IN_TRACE) && (defined(UNIX)||defined(unix)||defined(linux)) )
104 return "\033[0m\033[35m";
105#else
106 return "";
107#endif
108 }

◆ selfDisplay()

void DGtal::TraceWriterTerm::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

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