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