lilypond-0.0.27
[lilypond.git] / flower / dstream.hh
blobe38f30128f80ce52fd4534162425ce2a18719cee
1 // debug_stream
3 #ifndef DSTREAM_HH
4 #define DSTREAM_HH
6 #include "string.hh"
8 const char eol= '\n';
10 template<class K,class V>
11 struct Assoc;
13 /// debug stream
14 class Dstream
16 ostream *os;
17 int indentlvl;
18 bool local_silence;
19 String classname;
21 Assoc<String, bool> *silent;
22 public:
24 bool silence(String);
26 Dstream(ostream *r, const char * rcfile);
27 /**
28 if rcfile == 0, then do not read any rc file
31 virtual ~Dstream();
32 Dstream &identify_as(String s);
34 Dstream &operator << (String s);
36 /**
37 a class for providing debug output of nested structures,
38 with indents according to \{\}()[].
40 One can turn on and off specific messages using the Assoc silent.
41 This can be done automatically:
43 #define DEBUG dstream_.identify_as(__PRETTY_FUNCTION__)
45 DEBUG << "a message\n";
47 Init for the class names which should be silent can be given in a rc file.
50 #endif