> -----Original Message----- > From: Juergen Hermann [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 08, 2000 8:22 AM > To: [EMAIL PROTECTED] > Subject: Re: BaseMarkupSerializer/XMLSerializer - C++ Anyone ? > > > On Tue, 7 Mar 2000 11:14:27 -0800, David A. Lee wrote: > > >class OutputStream > >{ > >public: > > virtual int WriteBytes( XMLCh* , int n) = 0; > >}; > > > >should be sufficient shouldnt it ? > > Would say so, but I'd add a default ostream wrapper to it, > since that would cover 90% of everyday streaming (and if you > use things like socket++, another 5%). > > BTW, a direct ostream interface would also be 100% sufficient, > since you can always write your own streambuf for non-standard > data sinks. But writing a streambuf is a little more (but not > much more) complicated than implementing the above interface.
Having an ostream (or streambuf) wrapper for whatever output class eventually gets created is a good idea, and fairly straightforward. However, if the serializer is capable of writing information more than a few characters at a time, and typically used in that fashion, directly deriving from streambuf might be sufficient in terms of functionality but not always ideal in terms of performance. The iostream system (especially the ANSI-Standard, template-based beastie) is a very rich, powerful architecture. It is also sometimes a little top-heavy in implementation. For raw, low level "byte" oriented I/O, it is sometimes better to use a simpler class as described above, and then optionally wrap an ostream around it where the formatting is needed. - James > Ciao, Jürgen > > -- > Jürgen Hermann ([EMAIL PROTECTED]) > WEB.DE AG, Amalienbadstr.41, D-76227 Karlsruhe > Tel.: 0721/94329-0, Fax: 0721/94329-22 > >