]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/source-file.hh
``slikken kreng''
[lilypond.git] / flower / include / source-file.hh
1 //
2 //  source-file.hh -- declare Source_file
3 //
4 //  copyright 1997 Jan Nieuwenhuizen <janneke@gnu.org>
5
6 #ifndef SOURCE_FILE_HH
7 #define SOURCE_FILE_HH
8
9 #include <iostream>
10
11 #include "flower-proto.hh"
12 #include "string.hh"
13 #include "interval.hh"
14
15 /**
16   class for reading and mapping a file. 
17
18   duplicates a lot of Data_file and Text_stream.
19   should look at including Data_file's functionality:
20   get_line (), get_word () here.
21 */
22
23 class Source_file
24 {
25 public:
26   /** Ugh! filename gets changed! The path to the opened file may
27     change, since it might be searched in multiple directories.  */
28   Source_file (String filename_string_r );
29
30   Source_file (String name_string, String data_string);
31   virtual ~Source_file ();
32
33   char const* to_str0 () const;
34   virtual String error_string (char const* pos_str0 ) const;
35   std::istream * get_istream ();
36   bool in_b (char const* pos_str0 ) const;
37   int length () const;
38   virtual int get_line (char const* pos_str0 ) const;
39   String name_string () const;
40   String file_line_column_string (char const* str0 ) const;
41
42   // return start + n
43   char const* seek_str0 (int n);
44   // return here + n bytes
45   char const* forward_str0 (int n);
46   char const* pos_str0 () { return pos_str0_; }
47   String get_string (int n);
48   void set_pos (char const * pos_str0);
49 public:
50   Slice line_slice (char const* pos_str0) const;
51   String line_string (char const* pos_str0) const;
52   int get_column (char const* pos_str0) const;
53   int get_char (char const* pos_str0) const;
54
55   /*
56     DOCUMENT-ME
57    */
58   char const* pos_str0_;
59
60 private:
61   String name_string_;
62   std::istream* istream_;
63   File_storage * storage_;
64 };
65
66 #endif // SOURCE_FILE_HH //
67