7 /// indent of each level
11 should use Regexp library.
14 strip_pretty(String pret)
16 String cl(pret.left(pret.pos('(')-1));
17 int l = cl.lastPos(' ');
18 cl = cl.right(cl.len() -l);
23 strip_member(String pret)
25 String cl(pret.left(pret.lastPos(':')-2));
30 Dstream::identify_as(String name)
35 String mem(strip_pretty(name));
36 String cl(strip_member(mem));
39 if (silent->elt_query(mem))
41 else if (silent->elt_query(cl))
44 (*silent)[idx] = false;
46 local_silence = (*silent)[idx];
47 if (classname != idx && !local_silence) {
49 *os << "[" << classname << ":]";
55 Dstream::silence(String s)
57 if (!silent->elt_query(s))
63 Dstream::operator<<(String s)
65 if (local_silence|| !os)
68 for (const char *cp = s ; *cp; cp++)
73 case '(': indentlvl += INDTAB;
83 assert (indentlvl>=0) ;
87 *os << '\n' << String (' ', indentlvl) << flush;
96 /** only output possibility. Delegates all conversion to String class.
99 Dstream::Dstream(ostream *r, const char * cfg_nm )
102 silent = new Assoc<String,bool>;
107 const char * fn =cfg_nm ? cfg_nm : ".dstreamrc";
109 ifstream ifs(fn); // can't open
116 Text_record r( cfg++);
118 r.message("not enough fields in Dstream init.");
121 (*silent)[r[0]] = r[1].to_bool();