Mercurial > octave
annotate libinterp/corefcn/oct-strstrm.h @ 22868:87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
* make_int.cc, Canvas.h, GenericEventNotify.h, TextEdit.h, gl-select.h, QTerminal.h, files-dock-widget.h, history-dock-widget.h, octave-cmd.h, octave-dock-widget.h, octave-interpreter.h, thread-manager.h, welcome-wizard.h, workspace-model.h, workspace-view.h, base-text-renderer.h, comment-list.h, debug.h, dynamic-ld.cc, dynamic-ld.h, ft-text-renderer.cc, gl-render.h, gl2ps-print.cc, graphics.in.h, hook-fcn.h, input.h, load-path.h, mxarray.in.h, oct-errno.h, oct-fstrm.h, oct-handle.h, oct-iostrm.h, oct-lvalue.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.h, pr-output.cc, procstream.h, sighandlers.cc, symtab.h, text-renderer.h, txt-eng.h, variables.cc, workspace-element.h, __init_fltk__.cc, __init_gnuplot__.cc, ov-base-diag.h, ov-base-int.h, ov-base-scalar.h, ov-base-sparse.h, ov-base.h, ov-bool-mat.h, ov-bool-sparse.h, ov-bool.h, ov-builtin.h, ov-cell.h, ov-ch-mat.h, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.h, ov-cx-diag.h, ov-cx-mat.h, ov-cx-sparse.h, ov-fcn-handle.h, ov-fcn-inline.h, ov-fcn.h, ov-float.h, ov-flt-complex.h, ov-flt-cx-diag.h, ov-flt-cx-mat.h, ov-flt-re-diag.h, ov-flt-re-mat.h, ov-intx.h, ov-lazy-idx.h, ov-re-diag.h, ov-re-mat.h, ov-re-sparse.h, ov-scalar.h, ov-str-mat.h, ov-struct.h, ov-typeinfo.h, ov-usr-fcn.h, ovl.h, octave.h, lex.h, parse.h, pt-binop.h, pt-bp.h, pt-cell.h, pt-check.h, pt-classdef.h, pt-cmd.h, pt-const.h, pt-decl.h, pt-eval.h, pt-exp.h, pt-fcn-handle.h, pt-funcall.h, pt-id.h, pt-jump.h, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.h, pt-pr-code.h, pt-unop.h, pt-walk.h, pt.h, DiagArray2.h, MArray.h, MDiagArray2.h, MSparse.h, idx-vector.h, quit.h, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK.h, DASRT.h, DASSL.h, EIG.h, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h, Quad.h, aepbalance.h, base-dae.h, base-de.h, base-min.h, fEIG.h, gepbalance.h, gsvd.h, hess.h, lu.h, oct-rand.h, oct-spparms.h, qr.h, qrp.h, schur.h, sparse-lu.h, svd.h, child-list.h, file-stat.h, oct-passwd.h, oct-time.h, oct-uname.h, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, glob-match.h, lo-array-errwarn.h, lo-regexp.h, oct-mutex.h, pathsearch.h, str-vec.h, url-transfer.h:
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Dec 2016 10:59:29 -0500 |
parents | 89756f2f085b |
children | f75d289645ec |
rev | line source |
---|---|
2081 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
21739
diff
changeset
|
3 Copyright (C) 1996-2016 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 | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
2081 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
2081 | 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_strstrm_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_strstrm_h 1 |
2081 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
27 |
2445 | 28 #include <string> |
5765 | 29 #include <sstream> |
4051 | 30 |
2081 | 31 #include "oct-stream.h" |
32 | |
33 class | |
34 octave_base_strstream : public octave_base_stream | |
35 { | |
36 public: | |
37 | |
4587 | 38 octave_base_strstream (std::ios::openmode m = std::ios::out, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
39 octave::mach_info::float_format ff |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
40 = octave::mach_info::native_float_format ()) |
4587 | 41 : octave_base_stream (m, ff) { } |
2081 | 42 |
43 // Position a stream at OFFSET relative to ORIGIN. | |
44 | |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
45 int seek (off_t, int); |
2081 | 46 |
47 // Return current stream position. | |
48 | |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
49 virtual off_t tell (void); |
2081 | 50 |
51 // The name of the file. | |
52 | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
53 std::string name (void) const { return ""; } |
2081 | 54 |
3523 | 55 virtual std::streambuf *rdbuf (void) = 0; |
2081 | 56 |
57 virtual bool bad (void) const = 0; | |
58 | |
59 virtual void clear (void) = 0; | |
60 | |
3340 | 61 protected: |
62 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
63 ~octave_base_strstream (void) = default; |
3340 | 64 |
2081 | 65 private: |
66 | |
67 // No copying! | |
68 | |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
69 octave_base_strstream (const octave_base_strstream&) = delete; |
2081 | 70 |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
71 octave_base_strstream& operator = (const octave_base_strstream&) = delete; |
2081 | 72 }; |
73 | |
74 class | |
75 octave_istrstream : public octave_base_strstream | |
76 { | |
77 public: | |
78 | |
79 octave_istrstream (const char *data, | |
10313 | 80 std::ios::openmode arg_md = std::ios::out, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
81 octave::mach_info::float_format ff |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
82 = octave::mach_info::native_float_format ()) |
4587 | 83 : octave_base_strstream (arg_md, ff), is (data) { } |
2081 | 84 |
3523 | 85 octave_istrstream (const std::string& data, |
10313 | 86 std::ios::openmode arg_md = std::ios::out, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
87 octave::mach_info::float_format ff |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
88 = octave::mach_info::native_float_format ()) |
4587 | 89 : octave_base_strstream (arg_md, ff), is (data.c_str ()) { } |
2081 | 90 |
3340 | 91 static octave_stream |
3538 | 92 create (const char *data, std::ios::openmode arg_md = std::ios::out, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
93 octave::mach_info::float_format ff |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
94 = octave::mach_info::native_float_format ()); |
3340 | 95 |
96 static octave_stream | |
3538 | 97 create (const std::string& data, std::ios::openmode arg_md = std::ios::out, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
98 octave::mach_info::float_format ff |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
99 = octave::mach_info::native_float_format ()); |
2081 | 100 |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
101 // Return nonzero if EOF has been reached on this stream. |
2081 | 102 |
103 bool eof (void) const { return is.eof (); } | |
104 | |
3523 | 105 std::istream *input_stream (void) { return &is; } |
2081 | 106 |
3523 | 107 std::ostream *output_stream (void) { return 0; } |
2081 | 108 |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
109 off_t tell (void) { return is.tellg (); } |
9795
3ccd3a03944c
Fix fourth argument from sscanf
David Grundberg <davidg@cs.umu.se>
parents:
7017
diff
changeset
|
110 |
3523 | 111 std::streambuf *rdbuf (void) { return is ? is.rdbuf () : 0; } |
2081 | 112 |
113 bool bad (void) const { return is.bad (); } | |
114 | |
115 void clear (void) { is.clear (); } | |
116 | |
3340 | 117 protected: |
118 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
119 ~octave_istrstream (void) = default; |
3340 | 120 |
2081 | 121 private: |
122 | |
5765 | 123 std::istringstream is; |
2081 | 124 |
125 // No copying! | |
126 | |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
127 octave_istrstream (const octave_istrstream&) = delete; |
2081 | 128 |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
129 octave_istrstream& operator = (const octave_istrstream&) = delete; |
2081 | 130 }; |
131 | |
132 class | |
133 octave_ostrstream : public octave_base_strstream | |
134 { | |
135 public: | |
136 | |
3538 | 137 octave_ostrstream (std::ios::openmode arg_md = std::ios::out, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
138 octave::mach_info::float_format ff |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
139 = octave::mach_info::native_float_format ()) |
11584
cda4aa780d58
Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
140 : octave_base_strstream (arg_md, ff), os () { } |
2081 | 141 |
3340 | 142 static octave_stream |
3538 | 143 create (std::ios::openmode arg_md = std::ios::out, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
144 octave::mach_info::float_format ff |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
145 = octave::mach_info::native_float_format ()); |
2081 | 146 |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17822
diff
changeset
|
147 // Return nonzero if EOF has been reached on this stream. |
2081 | 148 |
149 bool eof (void) const { return os.eof (); } | |
150 | |
3523 | 151 std::istream *input_stream (void) { return 0; } |
2081 | 152 |
3523 | 153 std::ostream *output_stream (void) { return &os; } |
2081 | 154 |
5765 | 155 std::string str (void) { return os.str (); } |
2081 | 156 |
3523 | 157 std::streambuf *rdbuf (void) { return os ? os.rdbuf () : 0; } |
2081 | 158 |
159 bool bad (void) const { return os.bad (); } | |
160 | |
161 void clear (void) { os.clear (); } | |
162 | |
3340 | 163 protected: |
164 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
165 ~octave_ostrstream (void) = default; |
3340 | 166 |
2081 | 167 private: |
168 | |
5765 | 169 std::ostringstream os; |
2081 | 170 |
171 // No copying! | |
172 | |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
173 octave_ostrstream (const octave_ostrstream&) = delete; |
2081 | 174 |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
175 octave_ostrstream& operator = (const octave_ostrstream&) = delete; |
2081 | 176 }; |
177 | |
178 #endif | |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
179 |