2081
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 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 |
|
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 |
3503
|
26 #include <fstream> |
2081
|
27 |
|
28 #include "oct-stream.h" |
|
29 |
|
30 class |
|
31 octave_fstream : public octave_base_stream |
|
32 { |
|
33 public: |
|
34 |
3523
|
35 octave_fstream (const std::string& nm_arg, |
3544
|
36 std::ios::openmode md = std::ios::in|std::ios::out, |
2317
|
37 oct_mach_info::float_format flt_fmt = |
|
38 oct_mach_info::native); |
2081
|
39 |
3340
|
40 static octave_stream |
3544
|
41 create (const std::string& nm_arg, |
|
42 std::ios::openmode md = std::ios::in|std::ios::out, |
3340
|
43 oct_mach_info::float_format flt_fmt = oct_mach_info::native); |
2081
|
44 |
|
45 // Position a stream at OFFSET relative to ORIGIN. |
|
46 |
3546
|
47 int seek (std::streamoff offset, std::ios::seek_dir origin); |
2081
|
48 |
|
49 // Return current stream position. |
|
50 |
|
51 long tell (void) const; |
|
52 |
|
53 // Return non-zero if EOF has been reached on this stream. |
|
54 |
|
55 bool eof (void) const; |
|
56 |
|
57 // The name of the file. |
|
58 |
3523
|
59 std::string name (void) const { return nm; } |
2081
|
60 |
3523
|
61 std::istream *input_stream (void); |
2081
|
62 |
3523
|
63 std::ostream *output_stream (void); |
2081
|
64 |
3340
|
65 protected: |
|
66 |
|
67 ~octave_fstream (void) { } |
|
68 |
2081
|
69 private: |
|
70 |
3523
|
71 std::string nm; |
2081
|
72 |
3551
|
73 std::fstream fs; |
2081
|
74 |
|
75 // No copying! |
|
76 |
|
77 octave_fstream (const octave_fstream&); |
|
78 |
|
79 octave_fstream& operator = (const octave_fstream&); |
|
80 }; |
|
81 |
|
82 #endif |
|
83 |
|
84 /* |
|
85 ;;; Local Variables: *** |
|
86 ;;; mode: C++ *** |
|
87 ;;; End: *** |
|
88 */ |