Mercurial > octave
annotate libinterp/corefcn/oct-iostrm.h @ 31855:1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
In most classes in liboctave and libinterp (except for the files in
octave-value subdirectory) that had at least one of the following
functions defined
default constructor
copy constructor
copy assignment operator
destructor
declare all of them. In most cases, this means declaring default or
deleted functions. In some cases, explicit definitions have been
replaced by equivalent default functions. In some cases, default or
deleted move constructors and move assignment operators have also been
declared.
Files affected: __magick_read__.cc, c-file-ptr-stream.h, dynamic-ld.h,
environment.h, error.h, event-manager.h, fcn-info.h, genprops.awk,
gl-render.cc, gl-render.h, gl2ps-print.cc, graphics-toolkit.h,
graphics.cc, graphics.in.h, gtk-manager.h, hook-fcn.h, input.h,
interpreter.cc, latex-text-renderer.cc, load-path.h, load-save.h,
ls-hdf5.h, mex.cc, mxarray.h, oct-errno.h, oct-fstrm.h, oct-hist.h,
oct-iostrm.h, oct-map.h, oct-prcstrm.h, oct-process.h, oct-stdstrm.h,
oct-stream.cc, oct-stream.h, oct-strstrm.h, pager.h, procstream.h,
symrec.h, symtab.h, text-engine.h, text-renderer.h, utils.h,
__init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, audiodevinfo.cc,
octave.h, anon-fcn-validator.h, bp-table.h, comment-list.h, lex.h,
oct-lvalue.h, oct-parse.yy, parse.h, profiler.h, pt-args-block.h,
pt-binop.h, pt-bp.h, pt-cbinop.h, pt-classdef.h, pt-cmd.h, pt-decl.h,
pt-eval.h, pt-id.h, pt-misc.h, pt-spmd.h, token.h, Array-base.cc,
CColVector.h, CNDArray.h, CRowVector.h, CSparse.h, Range.h,
boolNDArray.h, boolSparse.h, chNDArray.h, dColVector.h, dNDArray.h,
dRowVector.h, dSparse.h, fCColVector.h, fCNDArray.h, fCRowVector.h,
fColVector.h, fNDArray.h, fRowVector.h, idx-vector.h, DASPK.h,
DASRT.h, DASSL.h, DET.h, LSODE.h, Quad.h, chol.h, oct-fftw.h,
oct-norm.cc, oct-rand.h, sparse-qr.cc, svd.cc, child-list.h,
file-stat.h, oct-env.h, oct-group.h, oct-time.h, action-container.h,
cmd-edit.cc, cmd-hist.cc, kpse.h, lo-array-errwarn.h, lo-regexp.h,
oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h,
oct-string.h, octave-preserve-stream-state.h, quit.h, unwind-prot.h,
and octave-svgconvert.cc.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 17 Feb 2023 23:27:46 -0500 |
parents | febd82d1a8de |
children | ae4e19c0a2b1 2e484f9f1f18 |
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 // |
31706
597f3ee61a48
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31605
diff
changeset
|
3 // Copyright (C) 1996-2023 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 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
26 #if ! defined (octave_oct_iostrm_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_iostrm_h 1 |
2081 | 28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
30 |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
31 #include <iosfwd> |
2877 | 32 |
2081 | 33 #include "oct-stream.h" |
34 | |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
35 OCTAVE_BEGIN_NAMESPACE(octave) |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
36 |
2081 | 37 class |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
38 base_iostream : public base_stream |
2081 | 39 { |
40 public: | |
41 | |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
42 base_iostream (const std::string& n = "", |
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
43 std::ios::openmode m = 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
|
44 mach_info::float_format ff = mach_info::native_float_format ()) |
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
45 : base_stream (m, ff), m_name (n) { } |
2081 | 46 |
31837
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
47 OCTAVE_DISABLE_COPY_MOVE (base_iostream) |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
48 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
49 protected: |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
50 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
51 ~base_iostream () = default; |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
52 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
53 public: |
2081 | 54 |
55 // Position a stream at OFFSET relative to ORIGIN. | |
56 | |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
57 int seek (off_t offset, int origin); |
2081 | 58 |
59 // Return current stream position. | |
60 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
61 off_t tell (); |
2081 | 62 |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
63 // Return nonzero if EOF has been reached on this stream. |
2081 | 64 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
65 bool eof () const; |
2081 | 66 |
67 // The name of the file. | |
68 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
69 std::string name () const { return m_name; } |
2081 | 70 |
71 protected: | |
72 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
73 void invalid_operation () const; |
2081 | 74 |
75 private: | |
76 | |
27172 | 77 std::string m_name; |
2081 | 78 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
79 virtual const char * stream_type () const = 0; |
2081 | 80 }; |
81 | |
82 class | |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
83 istream : public base_iostream |
2081 | 84 { |
85 public: | |
86 | |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
87 istream (std::istream *arg = nullptr, const std::string& n = "") |
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
88 : base_iostream (n, std::ios::in, mach_info::native_float_format ()), |
27172 | 89 m_istream (arg) |
5015 | 90 { } |
2081 | 91 |
31837
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
92 OCTAVE_DISABLE_COPY_MOVE (istream) |
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
93 |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
94 static stream |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
95 create (std::istream *arg = nullptr, const std::string& n = ""); |
2081 | 96 |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
97 // Return nonzero if EOF has been reached on this stream. |
3342 | 98 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
99 bool eof () const; |
3342 | 100 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
101 std::istream * input_stream () { return m_istream; } |
2081 | 102 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
103 std::ostream * output_stream () { return nullptr; } |
2081 | 104 |
3340 | 105 protected: |
106 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
107 ~istream () = default; |
3340 | 108 |
2081 | 109 private: |
110 | |
27172 | 111 std::istream *m_istream; |
2081 | 112 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
113 const char * stream_type () const { return "istream"; } |
2081 | 114 }; |
115 | |
116 class | |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
117 ostream : public base_iostream |
2081 | 118 { |
119 public: | |
120 | |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
121 ostream (std::ostream *arg, const std::string& n = "") |
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
122 : base_iostream (n, std::ios::out, mach_info::native_float_format ()), |
27172 | 123 m_ostream (arg) |
5015 | 124 { } |
2081 | 125 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31837
diff
changeset
|
126 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (ostream) |
31837
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
127 |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
128 static stream |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
129 create (std::ostream *arg, const std::string& n = ""); |
2081 | 130 |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
131 // Return nonzero if EOF has been reached on this stream. |
3342 | 132 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
133 bool eof () const; |
3342 | 134 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
135 std::istream * input_stream () { return nullptr; } |
2081 | 136 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
137 std::ostream * output_stream () { return m_ostream; } |
2081 | 138 |
3340 | 139 protected: |
140 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
141 ~ostream () = default; |
3340 | 142 |
2081 | 143 private: |
144 | |
27172 | 145 std::ostream *m_ostream; |
2081 | 146 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
147 const char * stream_type () const { return "ostream"; } |
2081 | 148 }; |
149 | |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
150 OCTAVE_END_NAMESPACE(octave) |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
151 |
2081 | 152 #endif |