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
16 #include "protected-scm.hh"
20 class for reading and mapping a file.
22 duplicates a lot of Data_file and Text_stream.
23 should look at including Data_file's functionality:
24 get_line (), get_word () here.
30 Source_file (String fn);
31 Source_file (String, String);
33 virtual ~Source_file ();
35 char const *to_str0 () const;
36 virtual String quote_input (char const *pos_str0) const;
37 istream *get_istream ();
38 bool contains (char const *pos_str0) const;
40 virtual int get_line (char const *pos_str0) const;
41 String name_string () const;
42 String file_line_column_string (char const *str0) const;
45 char const *seek_str0 (int n);
48 // return here + n bytes
49 char const *forward_str0 (int n);
50 char const *pos_str0 () { return pos_str0_; }
51 String get_string (int n);
52 void set_pos (char const *pos_str0);
54 Slice line_slice (char const *pos_str0) const;
55 String line_string (char const *pos_str0) const;
56 void get_counts (char const *pos_str0, int *, int *, int *) const;
61 This thing doubles as a file-storage/file-iterator object.
63 char const *pos_str0_;
65 SCM get_port () const;
69 Link_array<char> newline_locations_;
76 Protected_scm str_port_;
79 char *gulp_file (String fn, int *len);
81 #endif /* SOURCE_FILE_HH */