DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TraceWriterTerm.h
1 
17 #pragma once
18 
30 #if defined(TraceWriterTerm_RECURSES)
31 #error Recursive header files inclusion detected in TraceWriterTerm.h
32 #else // defined(TraceWriterTerm_RECURSES)
33 
34 #define TraceWriterTerm_RECURSES
35 
36 #if !defined TraceWriterTerm_h
37 
38 #define TraceWriterTerm_h
39 
40 
42 // Inclusions
43 #include <iostream>
44 #include <string>
45 #include "DGtal/base/TraceWriter.h"
47 
48 namespace DGtal
49 {
50 
52  // class TraceWriterTerm
61  // ----------------------- Standard services ------------------------------
63  {
64  public:
65 
71  TraceWriterTerm(std::ostream &aoutputStream=std::cerr) : TraceWriter(aoutputStream) {};
72 
73 
78 
79  // ----------------------- Interface --------------------------------------
80  public:
81 
86  void selfDisplay( std::ostream & out ) const;
87 
92  bool isValid() const;
93 
94 
100  std::string prefixWarning()
101  {
102 #if ( (defined(UNIX)||defined(unix)||defined(linux)) )
103  return "\033[0m\033[35m";
104 #else
105  return "";
106 #endif
107  }
108 
113  std::string prefixInfo()
114  {
115 #if ( (defined(UNIX)||defined(unix)||defined(linux)) )
116  return "\033[0m";
117 #else
118  return "";
119 #endif
120  }
121 
126  std::string prefixError()
127  {
128 #if ( (defined(UNIX)||defined(unix)||defined(linux)) )
129  return "\033[0m\033[31m[ERR]";
130 #else
131  return "";
132 #endif
133  }
134 
139  std::string prefixEmphase()
140  {
141 #if ( (defined(UNIX)||defined(unix)||defined(linux)) )
142  return "\033[0m\033[1m";
143 #else
144  return "";
145 #endif
146  }
147 
152  std::string postfixReset()
153  {
154 #if ( (defined(UNIX)||defined(unix)||defined(linux)) )
155  return "\033[0m";
156 #else
157  return "";
158 #endif
159  }
160 
161  private:
162 
168  TraceWriterTerm( const TraceWriterTerm & other );
169 
176  TraceWriterTerm & operator=( const TraceWriterTerm & other );
177 
178  }; // end of class TraceWriterTerm
179 
180 
187  std::ostream&
188  operator<<( std::ostream & out, const TraceWriterTerm & object );
189 
190 
191 } // namespace DGtal
192 
193 
194 // //
196 
197 #endif // !defined TraceWriterTerm_h
198 
199 #undef TraceWriterTerm_RECURSES
200 #endif // else defined(TraceWriterTerm_RECURSES)