2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1999--2012 Jan Nieuwenhuizen <janneke@gnu.org>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef SOURCE_FILE_HH
21 #define SOURCE_FILE_HH
23 #include "std-vector.hh"
24 #include "lily-proto.hh"
31 class for reading and mapping a file.
33 duplicates a lot of Data_file and Text_stream.
34 should look at including Data_file's functionality:
35 get_line (), get_word () here.
40 vector<char const *> newline_locations_;
42 vector<char> characters_;
49 DECLARE_SMOBS (Source_file);
51 Source_file (const string &fn);
52 Source_file (const string&, const string&);
54 char const *c_str () const;
55 virtual string quote_input (char const *pos_str0) const;
56 istream *get_istream ();
57 bool contains (char const *pos_str0) const;
59 virtual int get_line (char const *pos_str0) const;
60 void set_line (char const *pos_str0, int i);
61 string name_string () const;
62 string file_line_column_string (char const *str0) const;
65 Slice line_slice (char const *pos_str0) const;
66 string line_string (char const *pos_str0) const;
67 void get_counts (char const *pos_str0, int *, int *, int *, int *) const;
69 SCM get_port () const;
76 vector<char> gulp_file (const string &fn, int desired);
78 #endif /* SOURCE_FILE_HH */