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