Mercurial > octave
comparison libinterp/corefcn/oct-stream.h @ 31771:21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
* mk-opts.pl, external.txi, embedded.cc, make_int.cc, standalone.cc,
standalonebuiltin.cc, BaseControl.cc, BaseControl.h, ButtonControl.cc,
ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h,
CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h,
ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc,
Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h,
GenericEventNotify.h, KeyMap.cc, ListBoxControl.cc, ListBoxControl.h,
Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, Object.cc, Object.h,
ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc,
PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc,
PushTool.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc,
SliderControl.h, Table.cc, Table.h, TextControl.cc, TextControl.h, TextEdit.h,
ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h,
ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, gl-select.cc,
gl-select.h, qopengl-functions.h, qt-graphics-toolkit.h, qdialog.cpp,
qfontdialog.cpp, qprintdialog_win.cpp, liboctgui-build-info.h,
liboctgui-build-info.in.cc, color-picker.cc, color-picker.h, command-widget.cc,
command-widget.h, community-news.cc, community-news.h, dialog.cc, dialog.h,
documentation-bookmarks.cc, documentation-bookmarks.h,
documentation-dock-widget.cc, documentation-dock-widget.h, documentation.cc,
documentation.h, dw-main-window.cc, dw-main-window.h,
external-editor-interface.cc, external-editor-interface.h,
files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc,
find-files-dialog.h, find-files-model.cc, find-files-model.h,
gui-preferences.cc, gui-preferences.h, gui-settings.cc, gui-settings.h,
history-dock-widget.cc, history-dock-widget.h, interpreter-qobject.cc,
interpreter-qobject.h, file-editor-interface.h, file-editor-tab.cc,
file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc,
find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc, octave-qscintilla.h,
octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc, main-window.h,
news-reader.cc, news-reader.h, octave-dock-widget.cc, octave-dock-widget.h,
octave-qobject.cc, octave-qobject.h, qt-application.cc, qt-application.h,
qt-interpreter-events.cc, qt-interpreter-events.h, release-notes.cc,
release-notes.h, set-path-dialog.cc, set-path-dialog.h, set-path-model.cc,
set-path-model.h, settings-dialog.cc, settings-dialog.h,
shortcuts-tree-widget.cc, shortcuts-tree-widget.h, tab-bar.cc, tab-bar.h,
terminal-dock-widget.cc, terminal-dock-widget.h, variable-editor-model.cc,
variable-editor-model.h, variable-editor.cc, variable-editor.h,
welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-model.h,
workspace-view.cc, workspace-view.h, build-env.h, Cell.cc, Cell.h,
__contourc__.cc, __magick_read__.cc, auto-shlib.cc, auto-shlib.h,
base-text-renderer.h, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h,
call-stack.cc, call-stack.h, debug.cc, defaults.cc, defaults.h, defun.cc,
display.cc, display.h, dynamic-ld.cc, dynamic-ld.h, environment.cc,
environment.h, error.cc, error.h, errwarn.cc, errwarn.h, event-manager.cc,
event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h,
ft-text-renderer.cc, ft-text-renderer.h, genprops.awk, gh-manager.cc,
gh-manager.h, gl-render.cc, gl-render.h, gl2ps-print.cc, graphics-toolkit.h,
graphics.cc, graphics.in.h, gtk-manager.cc, gtk-manager.h, help.cc, help.h,
hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h,
interpreter.cc, interpreter.h, jsondecode.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
ls-hdf5.cc, ls-hdf5.h, mxarray.h, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc,
oct-fstrm.h, oct-handle.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc,
oct-iostrm.h, oct-map.cc, oct-map.h, oct-opengl.h, oct-prcstrm.cc,
oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.h, oct-stdstrm.h,
oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h,
oct-tex-lexer.in.ll, pager.cc, pager.h, pr-flt-fmt.cc, pr-flt-fmt.h,
pr-output.cc, pr-output.h, procstream.cc, procstream.h, settings.cc,
settings.h, sighandlers.cc, sighandlers.h, stack-frame.cc, stack-frame.h,
svd.cc, syminfo.cc, syminfo.h, symrec.cc, symrec.h, symscope.cc, symscope.h,
symtab.cc, symtab.h, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h,
text-renderer.cc, text-renderer.h, toplev.cc, url-handle-manager.cc,
url-handle-manager.h, variables.cc, xpow.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, audiodevinfo.cc, gzip.cc,
liboctinterp-build-info.h, liboctinterp-build-info.in.cc,
mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h,
cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h,
cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h,
cdef-utils.cc, cdef-utils.h, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc,
ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc,
ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h,
ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc,
ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc,
ov-ch-mat.h, ov-class.cc, 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.cc,
ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h,
ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.cc,
ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h,
ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h,
ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h,
ov-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-lazy-idx.h,
ov-legacy-range.cc, ov-legacy-range.h, ov-magic-int.cc, ov-magic-int.h,
ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc, ov-null-mat.h, ov-oncleanup.cc,
ov-oncleanup.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc,
ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h,
ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc,
ov-struct.h, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc,
ov.h, ovl.cc, ovl.h, octave.cc, octave.h, anon-fcn-validator.h, bp-table.cc,
bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll,
oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h,
pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc,
pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h,
pt-binop.cc, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h,
pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h, pt-decl.cc,
pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc,
pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc,
pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.h, pt-misc.cc, pt-misc.h,
pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h,
pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h,
pt-walk.h, pt.cc, pt.h, token.cc, token.h, usage.h, Array-base.cc, Array.h,
CColVector.cc, CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc,
CMatrix.h, CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, CSparse.cc,
CSparse.h, DiagArray2.cc, DiagArray2.h, MArray.cc, MArray.h, MDiagArray2.h,
MSparse.h, MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc,
Range.h, Sparse-b.cc, Sparse.cc, Sparse.h, boolMatrix.cc, boolMatrix.h,
boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h, chMatrix.h,
chNDArray.h, dColVector.cc, dColVector.h, dDiagMatrix.cc, dDiagMatrix.h,
dMatrix.cc, dMatrix.h, dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h,
dSparse.cc, dSparse.h, dim-vector.cc, dim-vector.h, fCColVector.cc,
fCColVector.h, fCDiagMatrix.cc, fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h,
fCNDArray.cc, fCNDArray.h, fCRowVector.cc, fCRowVector.h, fColVector.cc,
fColVector.h, fDiagMatrix.cc, fDiagMatrix.h, fMatrix.cc, fMatrix.h,
fNDArray.cc, fNDArray.h, fRowVector.cc, fRowVector.h, idx-vector.cc,
idx-vector.h, intNDArray.cc, intNDArray.h, liboctave-build-info.h,
liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h,
DAERTFunc.h, DASPK.cc, DASPK.h, DASRT.cc, DASRT.h, DASSL.cc, DASSL.h, DET.h,
EIG.h, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h, Quad.h,
aepbalance.cc, aepbalance.h, base-dae.h, base-de.h, chol.cc, chol.h,
eigs-base.cc, fEIG.h, gepbalance.h, gsvd.cc, gsvd.h, hess.h, lu.cc, lu.h,
oct-fftw.cc, oct-fftw.h, oct-rand.cc, oct-rand.h, oct-spparms.cc,
oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randmtzig.cc, randmtzig.h, schur.h,
sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc,
sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h,
file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h,
lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h,
oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc,
oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h,
action-container.h, base-list.h, caseless-str.h, cmd-edit.cc, cmd-edit.h,
cmd-hist.cc, cmd-hist.h, data-conv.cc, file-info.h, glob-match.cc,
glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc, lo-array-errwarn.h,
lo-hash.cc, lo-hash.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-regexp.h,
oct-inttypes.cc, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h,
oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, oct-sparse.cc,
octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc,
singleton-cleanup.cc, singleton-cleanup.h, str-vec.cc, str-vec.h,
unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h, version.cc,
version.in.h, cxx-signal-helpers.cc, acinclude.m4, main-cli.cc, main-gui.cc,
main.in.cc, mkoctfile.in.cc, octave-build-info.h, octave-build-info.in.cc,
octave-config.in.cc, octave-svgconvert.cc, shared-fcns.h:
maint: Eliminate "(void)" in C++ function prototypes/declarations.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 24 Jan 2023 17:19:44 -0800 |
parents | 597f3ee61a48 |
children | febd82d1a8de |
comparison
equal
deleted
inserted
replaced
31770:1d1eff97670e | 31771:21f9b34eb893 |
---|---|
83 | 83 |
84 base_stream (const base_stream&) = delete; | 84 base_stream (const base_stream&) = delete; |
85 | 85 |
86 base_stream& operator = (const base_stream&) = delete; | 86 base_stream& operator = (const base_stream&) = delete; |
87 | 87 |
88 virtual ~base_stream (void) = default; | 88 virtual ~base_stream () = default; |
89 | 89 |
90 // The remaining functions are not specific to input or output only, | 90 // The remaining functions are not specific to input or output only, |
91 // and must be provided by the derived classes. | 91 // and must be provided by the derived classes. |
92 | 92 |
93 // Position a stream at OFFSET relative to ORIGIN. | 93 // Position a stream at OFFSET relative to ORIGIN. |
94 | 94 |
95 virtual int seek (off_t offset, int origin) = 0; | 95 virtual int seek (off_t offset, int origin) = 0; |
96 | 96 |
97 // Return current stream position. | 97 // Return current stream position. |
98 | 98 |
99 virtual off_t tell (void) = 0; | 99 virtual off_t tell () = 0; |
100 | 100 |
101 // Return TRUE if EOF has been reached on this stream. | 101 // Return TRUE if EOF has been reached on this stream. |
102 | 102 |
103 virtual bool eof (void) const = 0; | 103 virtual bool eof () const = 0; |
104 | 104 |
105 // The name of the file. | 105 // The name of the file. |
106 | 106 |
107 virtual std::string name (void) const = 0; | 107 virtual std::string name () const = 0; |
108 | 108 |
109 // If the derived class provides this function and it returns a | 109 // If the derived class provides this function and it returns a |
110 // pointer to a valid istream, scanf(), read(), getl(), and gets() | 110 // pointer to a valid istream, scanf(), read(), getl(), and gets() |
111 // will automatically work for this stream. | 111 // will automatically work for this stream. |
112 | 112 |
113 virtual std::istream * input_stream (void) { return nullptr; } | 113 virtual std::istream * input_stream () { return nullptr; } |
114 | 114 |
115 // If the derived class provides this function and it returns a | 115 // If the derived class provides this function and it returns a |
116 // pointer to a valid ostream, flush(), write(), and printf() will | 116 // pointer to a valid ostream, flush(), write(), and printf() will |
117 // automatically work for this stream. | 117 // automatically work for this stream. |
118 | 118 |
119 virtual std::ostream * output_stream (void) { return nullptr; } | 119 virtual std::ostream * output_stream () { return nullptr; } |
120 | 120 |
121 // Return either the original output stream or one wrapped with the | 121 // Return either the original output stream or one wrapped with the |
122 // encoding facet. | 122 // encoding facet. |
123 | 123 |
124 std::ostream * preferred_output_stream (void) | 124 std::ostream * preferred_output_stream () |
125 { | 125 { |
126 if (! m_encoding.compare ("utf-8")) | 126 if (! m_encoding.compare ("utf-8")) |
127 return output_stream (); | 127 return output_stream (); |
128 | 128 |
129 if (m_conv_ostream) | 129 if (m_conv_ostream) |
143 return (m_conv_ostream ? m_conv_ostream : output_stream ()); | 143 return (m_conv_ostream ? m_conv_ostream : output_stream ()); |
144 } | 144 } |
145 | 145 |
146 // Return TRUE if this stream is open. | 146 // Return TRUE if this stream is open. |
147 | 147 |
148 bool is_open (void) const { return m_open_state; } | 148 bool is_open () const { return m_open_state; } |
149 | 149 |
150 virtual void do_close (void) { } | 150 virtual void do_close () { } |
151 | 151 |
152 void close (void) | 152 void close () |
153 { | 153 { |
154 if (is_open ()) | 154 if (is_open ()) |
155 { | 155 { |
156 m_open_state = false; | 156 m_open_state = false; |
157 do_close (); | 157 do_close (); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 virtual int file_number (void) const | 161 virtual int file_number () const |
162 { | 162 { |
163 // Kluge alert! | 163 // Kluge alert! |
164 | 164 |
165 if (name () == "stdin") | 165 if (name () == "stdin") |
166 return 0; | 166 return 0; |
170 return 2; | 170 return 2; |
171 else | 171 else |
172 return -1; | 172 return -1; |
173 } | 173 } |
174 | 174 |
175 bool ok (void) const { return ! m_fail; } | 175 bool ok () const { return ! m_fail; } |
176 | 176 |
177 // Return current error message for this stream. | 177 // Return current error message for this stream. |
178 | 178 |
179 std::string error (bool clear, int& err_num); | 179 std::string error (bool clear, int& err_num); |
180 | 180 |
181 protected: | 181 protected: |
182 | 182 |
183 int mode (void) const { return m_mode; } | 183 int mode () const { return m_mode; } |
184 | 184 |
185 mach_info::float_format float_format (void) const { return m_flt_fmt; } | 185 mach_info::float_format float_format () const { return m_flt_fmt; } |
186 | 186 |
187 std::string encoding (void) const { return m_encoding; } | 187 std::string encoding () const { return m_encoding; } |
188 | 188 |
189 // Set current error state and set fail to TRUE. | 189 // Set current error state and set fail to TRUE. |
190 | 190 |
191 OCTINTERP_API void error (const std::string& msg); | 191 OCTINTERP_API void error (const std::string& msg); |
192 OCTINTERP_API void error (const std::string& who, const std::string& msg); | 192 OCTINTERP_API void error (const std::string& who, const std::string& msg); |
193 | 193 |
194 // Clear any error message and set fail to FALSE. | 194 // Clear any error message and set fail to FALSE. |
195 | 195 |
196 OCTINTERP_API void clear (void); | 196 OCTINTERP_API void clear (); |
197 | 197 |
198 // Clear stream state. | 198 // Clear stream state. |
199 | 199 |
200 OCTINTERP_API void clearerr (void); | 200 OCTINTERP_API void clearerr (); |
201 | 201 |
202 private: | 202 private: |
203 | 203 |
204 // The permission bits for the file. Should be some combination of | 204 // The permission bits for the file. Should be some combination of |
205 // std::ios::open_mode bits. | 205 // std::ios::open_mode bits. |
271 const std::string& who, octave_idx_type& count); | 271 const std::string& who, octave_idx_type& count); |
272 | 272 |
273 // Functions that are defined for all output streams (output streams | 273 // Functions that are defined for all output streams (output streams |
274 // are those that define os). | 274 // are those that define os). |
275 | 275 |
276 OCTINTERP_API int flush (void); | 276 OCTINTERP_API int flush (); |
277 | 277 |
278 OCTINTERP_API int | 278 OCTINTERP_API int |
279 do_numeric_printf_conv (std::ostream& os, const printf_format_elt *elt, | 279 do_numeric_printf_conv (std::ostream& os, const printf_format_elt *elt, |
280 int nsa, int sa_1, int sa_2, | 280 int nsa, int sa_1, int sa_2, |
281 const octave_value& val, | 281 const octave_value& val, |
312 | 312 |
313 stream (const stream&) = default; | 313 stream (const stream&) = default; |
314 | 314 |
315 stream& operator = (const stream&) = default; | 315 stream& operator = (const stream&) = default; |
316 | 316 |
317 ~stream (void) = default; | 317 ~stream () = default; |
318 | 318 |
319 OCTINTERP_API int flush (void); | 319 OCTINTERP_API int flush (); |
320 | 320 |
321 OCTINTERP_API std::string | 321 OCTINTERP_API std::string |
322 getl (octave_idx_type max_len, bool& err, | 322 getl (octave_idx_type max_len, bool& err, |
323 const std::string& who /* = "getl" */); | 323 const std::string& who /* = "getl" */); |
324 | 324 |
344 OCTINTERP_API int seek (off_t offset, int origin); | 344 OCTINTERP_API int seek (off_t offset, int origin); |
345 | 345 |
346 OCTINTERP_API int | 346 OCTINTERP_API int |
347 seek (const octave_value& offset, const octave_value& origin); | 347 seek (const octave_value& offset, const octave_value& origin); |
348 | 348 |
349 OCTINTERP_API off_t tell (void); | 349 OCTINTERP_API off_t tell (); |
350 | 350 |
351 OCTINTERP_API int rewind (void); | 351 OCTINTERP_API int rewind (); |
352 | 352 |
353 OCTINTERP_API bool is_open (void) const; | 353 OCTINTERP_API bool is_open () const; |
354 | 354 |
355 OCTINTERP_API void close (void); | 355 OCTINTERP_API void close (); |
356 | 356 |
357 OCTINTERP_API octave_value | 357 OCTINTERP_API octave_value |
358 read (const Array<double>& size, octave_idx_type block_size, | 358 read (const Array<double>& size, octave_idx_type block_size, |
359 oct_data_conv::data_type input_type, | 359 oct_data_conv::data_type input_type, |
360 oct_data_conv::data_type output_type, | 360 oct_data_conv::data_type output_type, |
406 OCTINTERP_API int | 406 OCTINTERP_API int |
407 puts (const std::string& s, const std::string& who /* = "puts" */); | 407 puts (const std::string& s, const std::string& who /* = "puts" */); |
408 OCTINTERP_API int | 408 OCTINTERP_API int |
409 puts (const octave_value& s, const std::string& who /* = "puts" */); | 409 puts (const octave_value& s, const std::string& who /* = "puts" */); |
410 | 410 |
411 OCTINTERP_API bool eof (void) const; | 411 OCTINTERP_API bool eof () const; |
412 | 412 |
413 OCTINTERP_API std::string error (bool clear, int& err_num); | 413 OCTINTERP_API std::string error (bool clear, int& err_num); |
414 | 414 |
415 std::string error (bool clear = false) | 415 std::string error (bool clear = false) |
416 { | 416 { |
426 m_rep->error (msg); | 426 m_rep->error (msg); |
427 } | 427 } |
428 | 428 |
429 void error (const char *msg) { error (std::string (msg)); } | 429 void error (const char *msg) { error (std::string (msg)); } |
430 | 430 |
431 int file_number (void) { return m_rep ? m_rep->file_number () : -1; } | 431 int file_number () { return m_rep ? m_rep->file_number () : -1; } |
432 | 432 |
433 bool is_valid (void) const { return bool (m_rep); } | 433 bool is_valid () const { return bool (m_rep); } |
434 | 434 |
435 bool ok (void) const { return m_rep && m_rep->ok (); } | 435 bool ok () const { return m_rep && m_rep->ok (); } |
436 | 436 |
437 operator bool () const { return ok (); } | 437 operator bool () const { return ok (); } |
438 | 438 |
439 OCTINTERP_API std::string name (void) const; | 439 OCTINTERP_API std::string name () const; |
440 | 440 |
441 OCTINTERP_API int mode (void) const; | 441 OCTINTERP_API int mode () const; |
442 | 442 |
443 OCTINTERP_API mach_info::float_format float_format (void) const; | 443 OCTINTERP_API mach_info::float_format float_format () const; |
444 | 444 |
445 OCTINTERP_API static std::string mode_as_string (int mode); | 445 OCTINTERP_API static std::string mode_as_string (int mode); |
446 | 446 |
447 std::string encoding (void) | 447 std::string encoding () |
448 { | 448 { |
449 return m_rep ? m_rep->encoding () : std::string (); | 449 return m_rep ? m_rep->encoding () : std::string (); |
450 } | 450 } |
451 | 451 |
452 std::istream * input_stream (void) | 452 std::istream * input_stream () |
453 { | 453 { |
454 return m_rep ? m_rep->input_stream () : nullptr; | 454 return m_rep ? m_rep->input_stream () : nullptr; |
455 } | 455 } |
456 | 456 |
457 std::ostream * output_stream (void) | 457 std::ostream * output_stream () |
458 { | 458 { |
459 return (m_rep ? m_rep->preferred_output_stream () : nullptr); | 459 return (m_rep ? m_rep->preferred_output_stream () : nullptr); |
460 } | 460 } |
461 | 461 |
462 void clearerr (void) { if (m_rep) m_rep->clearerr (); } | 462 void clearerr () { if (m_rep) m_rep->clearerr (); } |
463 | 463 |
464 private: | 464 private: |
465 | 465 |
466 // The actual representation of this stream. | 466 // The actual representation of this stream. |
467 std::shared_ptr<base_stream> m_rep; | 467 std::shared_ptr<base_stream> m_rep; |
506 OCTINTERP_API stream_list (interpreter& interp); | 506 OCTINTERP_API stream_list (interpreter& interp); |
507 | 507 |
508 stream_list (const stream_list&) = delete; | 508 stream_list (const stream_list&) = delete; |
509 stream_list& operator = (const stream_list&) = delete; | 509 stream_list& operator = (const stream_list&) = delete; |
510 | 510 |
511 OCTINTERP_API ~stream_list (void); | 511 OCTINTERP_API ~stream_list (); |
512 | 512 |
513 OCTINTERP_API int insert (stream& os); | 513 OCTINTERP_API int insert (stream& os); |
514 | 514 |
515 OCTINTERP_API stream lookup (int fid, const std::string& who = "") const; | 515 OCTINTERP_API stream lookup (int fid, const std::string& who = "") const; |
516 OCTINTERP_API stream | 516 OCTINTERP_API stream |
523 OCTINTERP_API void clear (bool flush = true); | 523 OCTINTERP_API void clear (bool flush = true); |
524 | 524 |
525 OCTINTERP_API string_vector get_info (int fid) const; | 525 OCTINTERP_API string_vector get_info (int fid) const; |
526 OCTINTERP_API string_vector get_info (const octave_value& fid) const; | 526 OCTINTERP_API string_vector get_info (const octave_value& fid) const; |
527 | 527 |
528 OCTINTERP_API std::string list_open_files (void) const; | 528 OCTINTERP_API std::string list_open_files () const; |
529 | 529 |
530 OCTINTERP_API octave_value open_file_numbers (void) const; | 530 OCTINTERP_API octave_value open_file_numbers () const; |
531 | 531 |
532 OCTINTERP_API int get_file_number (const octave_value& fid) const; | 532 OCTINTERP_API int get_file_number (const octave_value& fid) const; |
533 | 533 |
534 OCTINTERP_API octave_value stdin_file (void) const; | 534 OCTINTERP_API octave_value stdin_file () const; |
535 OCTINTERP_API octave_value stdout_file (void) const; | 535 OCTINTERP_API octave_value stdout_file () const; |
536 OCTINTERP_API octave_value stderr_file (void) const; | 536 OCTINTERP_API octave_value stderr_file () const; |
537 | 537 |
538 private: | 538 private: |
539 | 539 |
540 typedef std::map<int, stream> ostrl_map; | 540 typedef std::map<int, stream> ostrl_map; |
541 | 541 |