2 // source-file.hh -- declare Source_file
4 // copyright 1997 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "flower-proto.hh"
11 #include "interval.hh"
14 class for reading and mapping a file.
16 duplicates a lot of Data_file and Text_stream.
17 should look at including Data_file's functionality:
18 get_line (), get_word () here.
24 /** Ugh! filename gets changed! The path to the opened file may
25 change, since it might be searched in multiple directories. */
26 Source_file (String filename_str_r );
28 Source_file (String name_str, String data_str);
29 virtual ~Source_file ();
31 char const* ch_C () const;
32 virtual String error_str (char const* pos_ch_C ) const;
33 istream * istream_l ();
34 bool in_b (char const* pos_ch_C ) const;
35 int length_i () const;
36 virtual int line_i (char const* pos_ch_C ) const;
37 String name_str () const;
38 String file_line_column_str (char const* ch_C ) const;
41 char const* seek_ch_C (int n);
42 // return here + n bytes
43 char const* forward_ch_C (int n);
44 char const* pos_ch_C () { return pos_ch_C_; }
45 String get_str (int n);
46 void set_pos (char const * pos_ch_C);
48 Slice line_slice (char const* pos_ch_C) const;
49 String line_str (char const* pos_ch_C) const;
50 int column_i (char const* pos_ch_C) const;
51 int char_i (char const* pos_ch_C) const;
56 char const* pos_ch_C_;
61 File_storage * storage_p_;
64 #endif // SOURCE_FILE_HH //