www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - stream prototype

So at some point my std.stream modifications turned into the prototype for a
similar but incompatible design.  As such, I haven't bothered with converting
everything, just enough for a proof of concept.  The code does include some
marginal awareness of UTF8 and UTF16 encoding but the file stream doesn't check
for a BOM or anything when a file is opened (if you want to operate on a wchar
file you need to set the encoding format manually on the stream object).  Also
notably missing are seek/scan functions and some other bells and whistles.  For
the moment I decided to leave the unformatted routines pretty minimal as byte
order issues demanded a bit more discussion.  And there's no provision for the
C++ style shift operator method (which is arguably a useful extension).

The file includes a unit test at the bottom that's really just a simple demo.
If you actually want to compile the code you'll need to pull down my modified
utf.d as well as unformat.d, and add std.format to the list of files to be
compiled (to resolve some buggy name mangling issues).  The files are here:


This is basically a conceptual port of the C++ stream design.  It allows for
configuration of when an exception is thrown and some other nice features,
though it may not have quite the flexibility of a Java-style design like Mango.
I figured it would serve as a useful reference for another concept even if it
isn't quite production ready.

Aug 05 2004