2 source-file.hh -- declare Source_file
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2005 Jan Nieuwenhuizen <janneke@gnu.org>
10 #define SOURCE_FILE_HH
15 #include "protected-scm.hh"
19 class for reading and mapping a file.
21 duplicates a lot of Data_file and Text_stream.
22 should look at including Data_file's functionality:
23 get_line (), get_word () here.
29 Source_file (String fn);
30 Source_file (String, String);
32 virtual ~Source_file ();
34 char const *to_str0 () const;
35 virtual String error_string (char const *pos_str0) const;
36 std::istream *get_istream ();
37 bool contains (char const *pos_str0) const;
39 virtual int get_line (char const *pos_str0) const;
40 String name_string () const;
41 String file_line_column_string (char const *str0) const;
44 char const *seek_str0 (int n);
47 // return here + n bytes
48 char const *forward_str0 (int n);
49 char const *pos_str0 () { return pos_str0_; }
50 String get_string (int n);
51 void set_pos (char const *pos_str0);
53 Slice line_slice (char const *pos_str0) const;
54 String line_string (char const *pos_str0) const;
55 int get_column (char const *pos_str0) const;
56 int get_char_of_line (char const *pos_str0) const;
61 This thing doubles as a file-storage/file-iterator object.
63 char const *pos_str0_;
65 SCM get_port () const { return str_port_; }
69 Link_array<char> newline_locations_;
70 std::istream *istream_;
76 Protected_scm str_port_;
79 char *gulp_file (String fn, int *len);
81 #endif /* SOURCE_FILE_HH */