DGtal 1.4.0
Loading...
Searching...
No Matches
TraceWriterTerm.h
1
17#pragma once
30#if defined(TraceWriterTerm_RECURSES)
31#error Recursive header files inclusion detected in TraceWriterTerm.h
32#else // defined(TraceWriterTerm_RECURSES)
34#define TraceWriterTerm_RECURSES
35
36#if !defined TraceWriterTerm_h
38#define TraceWriterTerm_h
39
40
42// Inclusions
43#include <iostream>
44#include <string>
45#include "DGtal/base/TraceWriter.h"
46#include "DGtal/base/Config.h"
48
49namespace DGtal
50{
51
53 // class TraceWriterTerm
62 // ----------------------- Standard services ------------------------------
64 {
65 public:
66
72 TraceWriterTerm(std::ostream &aoutputStream=std::cerr) : TraceWriter(aoutputStream) {};
73
74
79
80 // ----------------------- Interface --------------------------------------
81 public:
82
87 void selfDisplay( std::ostream & out ) const;
88
93 bool isValid() const;
94
95
101 std::string prefixWarning()
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 }
109
114 std::string prefixInfo()
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 }
122
127 std::string prefixError()
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 }
135
140 std::string prefixEmphase()
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 }
148
153 std::string postfixReset()
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 }
161
162 private:
163
170
178
179 }; // end of class TraceWriterTerm
180
181
188 std::ostream&
189 operator<<( std::ostream & out, const TraceWriterTerm & object );
190
191
192} // namespace DGtal
193
194
195// //
197
198#endif // !defined TraceWriterTerm_h
199
200#undef TraceWriterTerm_RECURSES
201#endif // else defined(TraceWriterTerm_RECURSES)
Implements trace prefix for color terminals.
TraceWriterTerm(const TraceWriterTerm &other)
TraceWriterTerm & operator=(const TraceWriterTerm &other)
void selfDisplay(std::ostream &out) const
TraceWriterTerm(std::ostream &aoutputStream=std::cerr)
Virtual Class to implement trace writers.
Definition TraceWriter.h:58
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)