Import of lilypond-1.3.0
[lilypond.git] / dstream.cc
blob197e5300cf778a607738a428631eee8e9f97babf
1 // implementation of debug/TeX stream.
2 #include <fstream.h>
4 #include "dstream.hh"
5 #include "string.hh"
9 dstream mtor(cout);
11 ///
12 dstream &
13 dstream::operator<<(String s)
15 for (const char *cp = s ; *cp; cp++)
16 switch(*cp)
18 case '{':
19 case '[':
20 case '(': indentlvl += INDTAB;
21 *os << *cp;
22 break;
24 case ')':
25 case ']':
26 case '}':
27 indentlvl -= INDTAB;
28 *os << *cp ;
30 if (indentlvl<0) indentlvl = 0;
31 break;
33 case '\n':
34 *os << '\n' << String (' ', indentlvl) << flush;
35 break;
36 default:
37 *os << *cp;
38 break;
40 return *this;
44 /** only output possibility. Delegates all conversion to String class.