lilypond-0.0.1
[lilypond.git] / flower / textdb.hh
blob8f906b8626e59efc77947285e2f2fe46aea7707e
1 #ifndef TEXTDB_HH
2 #define TEXTDB_HH
4 #include "textstr.hh"
6 /**: do "#" comments, read quote enclosed fields */
8 /// a "const" svec. Contents can't be changed.
9 class Text_record : svec<String>
11 int line_no;
12 String filename;
14 public:
15 Text_record() { } // needed because of other ctor
17 /// report an error in this line.
18 message(String s) {
19 cerr << '\n'<< filename << ": "<< line_no << s << "\n";
21 String operator[](int j) {
22 return svec<String>::operator[](j);
25 Text_record(svec<String> s, String fn, int j) : svec<String>(s) {
26 filename = fn; line_no = j;
28 svec<String>::sz;
31 /// abstraction for a datafile
32 class Text_db : private Data_file
34 public:
35 /// get a line with records
36 Text_record get_record();
38 Text_db(String fn):Data_file(fn) { }
39 Data_file::error;
40 Data_file::eof;
42 /// get next line.
43 Text_record operator++(int) {
44 return get_record();
46 /// are we done yet?
47 operator bool() {
48 return !eof();
53 /**
54 add a subrec/fieldsep/record separator
56 #endif