2 // source-file.hh -- declare Source_file
4 // copyright 1997 Jan Nieuwenhuizen <janneke@gnu.org>
11 #include "interval.hh"
17 class for reading and mapping a file.
19 duplicates a lot of Data_file and Text_stream.
20 should look at including Data_file's functionality:
21 get_line (), get_word () here.
27 /** Ugh! filename gets changed! The path to the opened file may
28 change, since it might be searched in multiple directories. */
29 Source_file (String filename_str_r );
31 Source_file (String name_str, String data_str);
32 virtual ~Source_file ();
34 char const* ch_C () const;
35 virtual String error_str (char const* pos_ch_C ) const;
36 istream * istream_l ();
37 bool in_b (char const* pos_ch_C ) const;
38 int length_i () const;
39 virtual int line_i (char const* pos_ch_C ) const;
40 String name_str () const;
41 String file_line_column_str (char const* ch_C ) const;
44 char const* seek_ch_C (int n);
45 // return here + n bytes
46 char const* forward_ch_C (int n);
47 char const* pos_ch_C () { return pos_ch_C_; }
48 String get_str (int n);
49 void set_pos (char const * pos_ch_C);
52 // String get_line ();
53 // String get_word ();
54 // only used in binary-source-file, currently
58 Slice line_slice (char const* pos_ch_C) const;
59 String line_str (char const* pos_ch_C) const;
60 int column_i (char const* pos_ch_C) const;
61 int char_i (char const* pos_ch_C) const;
63 char const* pos_ch_C_;
68 File_storage * storage_p_;
71 #endif // SOURCE_FILE_HH //