Mercurial > hg > octave-lyh
annotate src/oct-fstrm.h @ 14645:cbc00b587f36
also allow "end" indexing in classdef files
* lex.ll (is_keyword_token): Return zero if looking at end inside an
object index in classdef files.
From James Laird <james.laird@nicta.com.au>.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 17 May 2012 00:46:57 -0400 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
2081 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
2081 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2081 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2081 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_octave_fstream_h) | |
24 #define octave_octave_fstream_h 1 | |
25 | |
3503 | 26 #include <fstream> |
3775 | 27 #include <string> |
2081 | 28 |
29 #include "oct-stream.h" | |
30 | |
31 class | |
32 octave_fstream : public octave_base_stream | |
33 { | |
34 public: | |
35 | |
3523 | 36 octave_fstream (const std::string& nm_arg, |
10313 | 37 std::ios::openmode arg_md = std::ios::in|std::ios::out, |
38 oct_mach_info::float_format flt_fmt | |
39 = oct_mach_info::native_float_format ()); | |
2081 | 40 |
3340 | 41 static octave_stream |
3544 | 42 create (const std::string& nm_arg, |
10313 | 43 std::ios::openmode arg_md = std::ios::in|std::ios::out, |
44 oct_mach_info::float_format flt_fmt | |
45 = oct_mach_info::native_float_format ()); | |
2081 | 46 |
47 // Position a stream at OFFSET relative to ORIGIN. | |
48 | |
4797 | 49 int seek (long offset, int origin); |
2081 | 50 |
51 // Return current stream position. | |
52 | |
4797 | 53 long tell (void); |
2081 | 54 |
55 // Return non-zero if EOF has been reached on this stream. | |
56 | |
57 bool eof (void) const; | |
58 | |
3652 | 59 void do_close (void); |
60 | |
2081 | 61 // The name of the file. |
62 | |
3523 | 63 std::string name (void) const { return nm; } |
2081 | 64 |
3523 | 65 std::istream *input_stream (void); |
2081 | 66 |
3523 | 67 std::ostream *output_stream (void); |
2081 | 68 |
3340 | 69 protected: |
70 | |
71 ~octave_fstream (void) { } | |
72 | |
2081 | 73 private: |
74 | |
3523 | 75 std::string nm; |
2081 | 76 |
3551 | 77 std::fstream fs; |
2081 | 78 |
79 // No copying! | |
80 | |
81 octave_fstream (const octave_fstream&); | |
82 | |
83 octave_fstream& operator = (const octave_fstream&); | |
84 }; | |
85 | |
86 #endif |