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