Mercurial > hg > octave-shane
changeset 2148:ee08cc210438
[project @ 1996-05-13 06:42:10 by jwe]
author | jwe |
---|---|
date | Mon, 13 May 1996 06:43:06 +0000 |
parents | 678cb6a93368 |
children | 2d352d57a5ab |
files | src/file-io.cc src/oct-stream.h |
diffstat | 2 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -541,7 +541,7 @@ octave_ostrstream ostr; - octave_stream os (&ostr); + octave_stream os (&ostr, true); if (os) { @@ -673,7 +673,7 @@ octave_istrstream istr (data); - octave_stream os (&istr); + octave_stream os (&istr, true); if (os) {
--- a/src/oct-stream.h +++ b/src/oct-stream.h @@ -362,9 +362,14 @@ { public: - octave_stream (octave_base_stream *bs = 0) : rep (bs) { } + octave_stream (octave_base_stream *bs = 0, bool pf = false) + : rep (bs), preserve (pf) { } - ~octave_stream (void) { delete rep; } + ~octave_stream (void) + { + if (! preserve) + delete rep; + } int flush (void); @@ -429,6 +434,9 @@ // The actual representation of this stream. octave_base_stream *rep; + // If true, don't delete rep. + bool preserve; + void invalid_stream_error (const char *op) const; bool stream_ok (const char *op, bool clear = true) const