annotate libinterp/corefcn/oct-fstrm.h @ 29991:3988112c7116

move i/o stream classes inside octave namespace * c-file-ptr-stream.h, c-file-ptr-stream.cc, file-io.cc, oct-fstrm.cc, oct-fstrm.h, oct-iostrm.cc, oct-iostrm.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-stdstrm.h, oct-stream.cc, oct-strstrm.cc, oct-strstrm.h, procstream.cc, procstream.h: Move classes inside octave namespace. Change all uses. Provide deprecated typedefs to preserve old names where possible.
author John W. Eaton <jwe@octave.org>
date Tue, 17 Aug 2021 11:17:36 -0400
parents 0a5b15007766
children 796f54d4ddbf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
3 // Copyright (C) 1996-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #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
27 #define octave_oct_fstrm_h 1
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
30
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3340
diff changeset
31 #include <fstream>
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
32 #include <string>
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
33
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
34 #include "oct-stream.h"
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
35
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
36 OCTAVE_NAMESPACE_BEGIN
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
37
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
38 class
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
39 fstream : public base_stream
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
40 {
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
41 public:
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
42
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
43 fstream (const std::string& nm_arg,
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
44 std::ios::openmode arg_md = std::ios::in | std::ios::out,
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
45 mach_info::float_format flt_fmt = mach_info::native_float_format ());
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
46
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
47 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
48
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
49 fstream (const fstream&) = delete;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
50
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
51 fstream& operator = (const fstream&) = delete;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
52
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
53 static stream
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3523
diff changeset
54 create (const std::string& nm_arg,
21662
5b9868c2e212 maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents: 21244
diff changeset
55 std::ios::openmode arg_md = std::ios::in | std::ios::out,
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
56 mach_info::float_format flt_fmt = mach_info::native_float_format ());
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
57
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
58 // Position a stream at OFFSET relative to ORIGIN.
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
59
16011
8122286c69a9 initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
60 int seek (off_t offset, int origin);
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
61
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
62 // Return current stream position.
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
63
16011
8122286c69a9 initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
64 off_t tell (void);
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
65
18812
9ac2357f19bc doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents: 17822
diff changeset
66 // Return nonzero if EOF has been reached on this stream.
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
67
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
68 bool eof (void) const;
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
69
3652
25e84fcef38a [project @ 2000-03-31 08:50:48 by jwe]
jwe
parents: 3570
diff changeset
70 void do_close (void);
25e84fcef38a [project @ 2000-03-31 08:50:48 by jwe]
jwe
parents: 3570
diff changeset
71
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
72 // The name of the file.
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
73
27172
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
74 std::string name (void) const { return m_name; }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
75
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
76 std::istream * input_stream (void);
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
77
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
78 std::ostream * output_stream (void);
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
79
3340
585a8809fd9b [project @ 1999-11-05 07:02:30 by jwe]
jwe
parents: 2847
diff changeset
80 protected:
585a8809fd9b [project @ 1999-11-05 07:02:30 by jwe]
jwe
parents: 2847
diff changeset
81
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
82 ~fstream (void) = default;
3340
585a8809fd9b [project @ 1999-11-05 07:02:30 by jwe]
jwe
parents: 2847
diff changeset
83
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
84 private:
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
85
27172
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
86 std::string m_name;
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
87
27172
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
88 std::fstream m_fstream;
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
89 };
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
90
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
91 OCTAVE_NAMESPACE_END
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
92
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
93 #if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
94
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
95 OCTAVE_DEPRECATED (7, "use 'octave::fstream' instead")
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
96 typedef octave::fstream octave_fstream;
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
97
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
98 #endif
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
99
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
100 #endif