RE: [boost]Interest in library generating streambufs from objects

2003-06-09 Thread Reece Dunn
I am also interested in this. I like the idea of being able to compose 
streambufs to combine facilities, possibly something like this:

template typename CharT, class StreamBuf 
class streambuf_compose
{
};
Where it inherits from the parent streambuf. I have not though this idea 
through completely yet.

I am also interested in indentation facilities, with the ability to turn 
them off (e.g. formatting CDATA or PRE tags in XML/HTML).

Also, is there a way for you to bind a streambuf to a stream? I have not had 
any direct experience with stream buffers, so I don't know. If not, it would 
be a good idea to have an I/O stream that can have a custom stream buffer, 
that way you can use stream facilities on these buffers, thus gaining access 
to compression, encription, etc.

I have basic code that writes a stream to a Windows console using WriteFile 
and GetStdHandle functions. This is not a complete stream implementation, 
but would be useful to have - expressed as I/O traits?? E.g.

class windows_io_traits
{
  public:
 typedef HANDLE handle_type;
  public:
 inline handle_type get_output_handle()
 {
return( ::GetStdHandle( STD_OUT_HANDLE ));
 }
 inline write( handle_type h, const char * data, long len )
 {
::WriteFile( h, data, len );
 }
};
Regards,
Reece
_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


RE: [boost]Interest in library generating streambufs from objects

2003-06-08 Thread Robert Ramey
This a very ripe subject

My interest stems from my efforts regarding a serialization library.   I have
had occasion to consider alternatives in this light.  I have looked at
Jeffs compression streambuf.   I think its interesting, useful and nicely done.
Given this, maybe you should set your sights even higher.

I think it would be more interesting if the following were considered

a) composability - suppose I have an encryption facility and a
compression facility.  I would like to be able to make a
streambuf the compresses thhen encryrpts or vice versa.

b) suppose I add other facilities such as escaping/unescaping
ascii characters, convert to/from wide characters, etc.  I should
be able to compose these in an arbitray way.

c) this suggests to me:
i) a implemention set of composable iterator adaptors.
ii) a streambuf that can filter input/output through an itererator adaptor.  
This
MIGHT be implemented as a codecvt facet that takes an interator adaptor
as an argument.

d) This would have the advantage that the conversion facilities would be useful
way beyond streambuf 

e) currently, the new iterator adaptor package doesn't include an example that
is suitable for use as a basis for such conversion or transformational adaptors.
But its not hard to make one.

To summarize, I would like see the concept of adaptable sequence factored
out of streambuf and a streambuf built that can use any adaptable sequence.

Robert Ramey


Jeff Garland wrote

Jonathon T. wrote:
  I have several class templates for producing standard streambufs based on
 classes with read, write and seek functions (or a suitable subset thereof.)
 I have used them successfully to access tcp connections, cryptographic
 routines, OLE compound documents, zip files, etc.
  There are templates istreambuf and ostreambuf which perform either input or
 output exclusively, a template double_streambuf which behaves like an
 istreambuf glued to an ostreambuf, and a template bidirectional_streambuf
 which performs input and output using a single shared buffer with a single
 repositionable file pointer.
  In addition, template parameters can be used to specify code conversion and
 to turn off buffering, and a contained error object can be used to customize
 exception throwing.
  I there is any interest, I will post them at the vault.
 

Jonathan --

I have an interest in this (sorry for the slow response) for a couple reasons.
1) I'd be interested in how this fits with the Boost Socket initiative
http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?BoostSocket
2) I've written something similar for zip files, but looks like you may have
a more general solution -- a toolkit for creating new streambuf types. If
this is the case, it would be very handy.

Jeff

___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost