🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.comp.lang.c++
Article #2006

Help:ostrstream/strstreambuf

#2006
From: Dieter Lücking
Date: Thu, 04 Apr 1996 19:36
40 lines
1423 bytes
I attempt to implement a stream for message boxes.
First the example:

   class MessageBuffer : public strstreambuf
   {
      public:
      MessageBuffer()
      : strstreambuf()
      {}
	  
	  // ... more constructors
      
      virtual int sync()                   // *** First question *** //
	  {
	     // Target specific implementation.
		 // A simple example:
	     cout << this; return __NOT_EOF;
	  }
   };
   
   class Message : public ostrstream
   {
      public:
      Message()
      : ostrstream()
      { init(new MessageBuffer); }          // *** Second question *** //
      
	  // ... more constructors
   };

First question:
The function sync() should only executed if ostream::flush() is called. However i am not sure. 
Are there any side effects ?

Second question:
Deletes ~ios() any the streambuffer object or is it a job for ~Message() ?

Thanks
Danke schoen
   Dieter Luecking
Technical Details
Message-ID: <316424B7.6B9E@braunschweig.netsurf.de>
Path: arc1-ca.pugleaf.net!news.bs.tpl.net!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.bs.tpl.net!news
From: Dieter Lücking <luecking@braunschweig.netsurf.de>
Newsgroups: de.comp.lang.c++
Subject: Help:ostrstream/strstreambuf
Date: Thu, 04 Apr 1996 20:36:23 +0100
Organization: IRD Daten- und Netzwerktechnik
Message-ID: <316424B7.6B9E@braunschweig.netsurf.de>
NNTP-Posting-Host: plueckin.braunschweig.netsurf.de
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0 (Win95; I)