]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/dstream.hh
patch::: 1.3.144.jcn6
[lilypond.git] / flower / include / dstream.hh
1 /*
2   dstream.hh -- declare Dstream
3
4   source file of the Flower Library
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef DSTREAM_HH
10 #define DSTREAM_HH
11
12 #include "string.hh"
13
14
15 const char eol= '\n';
16
17 /**  Debug stream. 
18    a class for providing debug output of nested structures,
19    with indents according to \{\} ()[].
20
21    One can turn on and off specific messages using the Assoc silent.
22    This can be done automatically:
23
24    #define DEBUG  dstream_.identify_as (__PRETTY_FUNCTION__) 
25
26    DEBUG << "a message\n";
27    
28    Init for the class names which should be silent can be given in a rc file. 
29    
30    TODO:
31    make a baseclass for indentable streams.
32
33    JUNKME
34   */
35 class Dstream
36 {
37   ostream *os_l_;
38   int indent_level_i_;
39   bool local_silence_b_;
40   bool default_silence_b_;
41   String current_classname_str_;
42   void output (String s);
43   Dictionary<bool> *silent_dict_p_;
44   
45 public:
46   void clear_silence ();
47   bool silent_b (String) const;
48     
49   /**
50      if rcfile == 0, then do not read any rc file.
51   */
52   Dstream (ostream *r, char const * rcfile);
53   virtual ~Dstream ();
54   Dstream &identify_as (String s);
55
56
57   Dstream &operator << (String);
58   Dstream &operator << (Real);
59   Dstream &operator << (int);  
60   Dstream &operator << (Rational);
61   Dstream &operator << (char);  
62   /**
63      Output memory locations.
64   */
65   Dstream &operator << (void const *);
66   Dstream &operator << (char const *);
67 };
68 #endif
69