]> git.donarmstrong.com Git - lilypond.git/blob - flower/dstream.hh
release: 0.0.2
[lilypond.git] / flower / dstream.hh
1 // debug_stream
2
3 #ifndef DSTREAM_HH
4 #define DSTREAM_HH
5
6 #include "string.hh"
7 #include "assoc.hh"
8
9 const char eol= '\n';
10
11 /// debug stream
12 class Dstream
13 {
14     ostream *os;
15     int indentlvl;
16     bool local_silence;
17     String classname;
18
19     Assoc<String, bool> silent;
20 public:
21
22     bool silence(String);
23     
24     Dstream(ostream *r, const char  * rcfile);
25     /**
26       if rcfile == 0, then do not read any rc file
27       */
28       
29     Dstream &identify_as(String s);
30     
31     Dstream &operator << (String s);
32 };
33  /**
34    a class for providing debug output of nested structures,
35    with indents according to \{\}()[].
36
37    One can turn on and off specific messages using the Assoc silent.
38    This can be done automatically:
39
40    #define DEBUG  dstream_.identify_as(__PRETTY_FUNCTION__) 
41
42    DEBUG << "a message\n";
43    
44    Init for the class names which should be silent can be given in a rc file. 
45    
46   */
47 #endif
48