diff src/oct-strstrm.h @ 3340:585a8809fd9b

[project @ 1999-11-05 07:02:30 by jwe]
author jwe
date Fri, 05 Nov 1999 07:02:36 +0000
parents 8b262e771614
children d14c483b3c12
line wrap: on
line diff
--- a/src/oct-strstrm.h	Thu Nov 04 16:24:31 1999 +0000
+++ b/src/oct-strstrm.h	Fri Nov 05 07:02:36 1999 +0000
@@ -39,8 +39,6 @@
 			 oct_mach_info::native)
     : octave_base_stream (arg_md, flt_fmt) { }
 
-  ~octave_base_strstream (void) { }
-
   // Position a stream at OFFSET relative to ORIGIN.
 
   int seek (streamoff offset, ios::seek_dir origin);
@@ -51,7 +49,7 @@
 
   // The name of the file.
 
-  string name (void) { return string (); }
+  string name (void) const { return string (); }
 
   virtual streambuf *rdbuf (void) = 0;
 
@@ -59,6 +57,10 @@
 
   virtual void clear (void) = 0;
 
+protected:
+
+  ~octave_base_strstream (void) { }
+
 private:
 
   // No copying!
@@ -85,7 +87,13 @@
 		     oct_mach_info::native)
     : octave_base_strstream (arg_md, flt_fmt), is (data.c_str ()) { }
 
-  ~octave_istrstream (void) { }
+  static octave_stream
+  create (const char *data, ios::openmode arg_md = ios::out,
+	  oct_mach_info::float_format flt_fmt = oct_mach_info::native);
+
+  static octave_stream
+  create (const string& data, ios::openmode arg_md = ios::out,
+	  oct_mach_info::float_format flt_fmt = oct_mach_info::native);
 
   // Return non-zero if EOF has been reached on this stream.
 
@@ -101,6 +109,10 @@
 
   void clear (void) { is.clear (); }
 
+protected:
+
+  ~octave_istrstream (void) { }
+
 private:
 
   istrstream is;
@@ -122,7 +134,9 @@
 		     oct_mach_info::native)
     : octave_base_strstream (arg_md, flt_fmt) { }
 
-  ~octave_ostrstream (void) { }
+  static octave_stream
+  create (ios::openmode arg_md = ios::out,
+	  oct_mach_info::float_format flt_fmt = oct_mach_info::native);
 
   // Return non-zero if EOF has been reached on this stream.
 
@@ -132,10 +146,13 @@
 
   ostream *output_stream (void) { return &os; }
 
-  char *str (void)
+  string str (void)
     {
       os << ends;
-      return os.str ();
+      char *tmp = os.str ();
+      string retval = tmp;
+      delete [] tmp;
+      return retval;
     }
 
   streambuf *rdbuf (void) { return os ? os.rdbuf () : 0; }
@@ -144,6 +161,10 @@
 
   void clear (void) { os.clear (); }
 
+protected:
+
+  ~octave_ostrstream (void) { }
+
 private:
 
   ostrstream os;