Mercurial > octave
annotate libinterp/corefcn/oct-fstrm.h @ 21662:5b9868c2e212
maint: Octave coding convention cleanups.
* Figure.cc, QtHandlesUtils.cc, files-dock-widget.cc, find-files-dialog.cc,
debug.cc, ls-hdf5.h, oct-fstrm.h, oct-iostrm.h, oct-stdstrm.h, oct-stream.h,
pr-output.cc, sysdep.cc, zfstream.h, pt-cbinop.cc, f77-fcn.h, DASPK.cc,
DASSL.cc, cmd-hist.cc, glob-match.h:
Cuddle angle bracket '<' next to C++ cast operator.
Space between variable reference and variable name (int& a).
Space between bitwise operators and their operands (A & B).
Create typedef tree_expression_ptr_t to avoid "tree_expression *&a"
which is unclear.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 02 May 2016 11:13:50 -0700 |
parents | 1473547f50f5 |
children | c4ab2e54f100 |
rev | line source |
---|---|
2081 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18812
diff
changeset
|
3 Copyright (C) 1996-2015 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 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
23 #if ! defined (octave_oct_fstrm_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
24 #define octave_oct_fstrm_h 1 |
2081 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
27 |
3503 | 28 #include <fstream> |
3775 | 29 #include <string> |
2081 | 30 |
31 #include "oct-stream.h" | |
32 | |
33 class | |
34 octave_fstream : public octave_base_stream | |
35 { | |
36 public: | |
37 | |
3523 | 38 octave_fstream (const std::string& nm_arg, |
21662
5b9868c2e212
maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents:
21244
diff
changeset
|
39 std::ios::openmode arg_md = std::ios::in | std::ios::out, |
10313 | 40 oct_mach_info::float_format flt_fmt |
41 = oct_mach_info::native_float_format ()); | |
2081 | 42 |
3340 | 43 static octave_stream |
3544 | 44 create (const std::string& nm_arg, |
21662
5b9868c2e212
maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents:
21244
diff
changeset
|
45 std::ios::openmode arg_md = std::ios::in | std::ios::out, |
10313 | 46 oct_mach_info::float_format flt_fmt |
47 = oct_mach_info::native_float_format ()); | |
2081 | 48 |
49 // Position a stream at OFFSET relative to ORIGIN. | |
50 | |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
51 int seek (off_t offset, int origin); |
2081 | 52 |
53 // Return current stream position. | |
54 | |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
55 off_t tell (void); |
2081 | 56 |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
57 // Return nonzero if EOF has been reached on this stream. |
2081 | 58 |
59 bool eof (void) const; | |
60 | |
3652 | 61 void do_close (void); |
62 | |
2081 | 63 // The name of the file. |
64 | |
3523 | 65 std::string name (void) const { return nm; } |
2081 | 66 |
3523 | 67 std::istream *input_stream (void); |
2081 | 68 |
3523 | 69 std::ostream *output_stream (void); |
2081 | 70 |
3340 | 71 protected: |
72 | |
73 ~octave_fstream (void) { } | |
74 | |
2081 | 75 private: |
76 | |
3523 | 77 std::string nm; |
2081 | 78 |
3551 | 79 std::fstream fs; |
2081 | 80 |
81 // No copying! | |
82 | |
83 octave_fstream (const octave_fstream&); | |
84 | |
85 octave_fstream& operator = (const octave_fstream&); | |
86 }; | |
87 | |
88 #endif |