2081
|
1 /* |
|
2 |
|
3 Copyright (C) 1996 John W. Eaton |
|
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 |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
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 |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_octave_fstream_h) |
|
24 #define octave_octave_fstream_h 1 |
|
25 |
|
26 #include <fstream.h> |
|
27 |
|
28 #include "oct-stream.h" |
|
29 |
|
30 class |
|
31 octave_fstream : public octave_base_stream |
|
32 { |
|
33 public: |
|
34 |
|
35 octave_fstream (const string& nm_arg, |
|
36 ios::openmode md = ios::in|ios::out, |
|
37 octave_base_stream::arch_type at = native); |
|
38 |
|
39 ~octave_fstream (void) { } |
|
40 |
|
41 // Position a stream at OFFSET relative to ORIGIN. |
|
42 |
|
43 int seek (streampos offset, ios::seek_dir origin); |
|
44 |
|
45 // Return current stream position. |
|
46 |
|
47 long tell (void) const; |
|
48 |
|
49 // Return non-zero if EOF has been reached on this stream. |
|
50 |
|
51 bool eof (void) const; |
|
52 |
|
53 // The name of the file. |
|
54 |
|
55 string name (void); |
|
56 |
|
57 istream *input_stream (void); |
|
58 |
|
59 ostream *output_stream (void); |
|
60 |
|
61 private: |
|
62 |
|
63 string nm; |
|
64 |
|
65 fstream fs; |
|
66 |
|
67 // No copying! |
|
68 |
|
69 octave_fstream (const octave_fstream&); |
|
70 |
|
71 octave_fstream& operator = (const octave_fstream&); |
|
72 }; |
|
73 |
|
74 #endif |
|
75 |
|
76 /* |
|
77 ;;; Local Variables: *** |
|
78 ;;; mode: C++ *** |
|
79 ;;; End: *** |
|
80 */ |