2 source-file.hh -- declare Source_file
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2006 Jan Nieuwenhuizen <janneke@gnu.org>
10 #define SOURCE_FILE_HH
12 #include "flower-proto.hh"
13 #include "std-vector.hh"
14 #include "lily-proto.hh"
15 #include "protected-scm.hh"
21 class for reading and mapping a file.
23 duplicates a lot of Data_file and Text_stream.
24 should look at including Data_file's functionality:
25 get_line (), get_word () here.
31 Source_file (string fn);
32 Source_file (string, string);
34 virtual ~Source_file ();
36 char const *c_str () const;
37 virtual string quote_input (char const *pos_str0) const;
38 istream *get_istream ();
39 bool contains (char const *pos_str0) const;
41 virtual int get_line (char const *pos_str0) const;
42 void set_line (char const *pos_str0, int i);
43 string name_string () const;
44 string file_line_column_string (char const *str0) const;
47 char const *seek_str0 (int n);
50 // return here + n bytes
51 char const *forward_str0 (int n);
52 char const *pos_str0 () { return pos_str0_; }
53 string get_string (int n);
54 void set_pos (char const *pos_str0);
56 Slice line_slice (char const *pos_str0) const;
57 string line_string (char const *pos_str0) const;
58 void get_counts (char const *pos_str0, int *, int *, int *) const;
63 This thing doubles as a file-storage/file-iterator object.
65 char const *pos_str0_;
67 SCM get_port () const;
74 vector<char*> newline_locations_;
82 Protected_scm str_port_;
85 char *gulp_file (string fn, int *len);
87 #endif /* SOURCE_FILE_HH */