Boost logo

Boost :

From: Ares Lagae (ares.lagae_at_[hidden])
Date: 2007-06-06 09:10:53


I have updated the binary_iostreams library.

Changes:
- some small bugfixes
- added classes binary_istringstream, binary_ostringstream and
binary_stringstream
- removed << and >> operators for string types

* classes binary_istringstream, binary_ostringstream and binary_stringstream

The classes binary_istringstream, binary_ostringstream and
binary_stringstream allow to read/write to a string that serves as buffer
for the binary data. (althought a streambuf that writes to
std::vector<unsigned char> would be more suited).

For example:

binary_stringstream bostringstream;
bostringstream << p[0] << p[1] << p[2];
const std::string& buffer = bostringstream.str();
// write buffer a binary_ostream
std::copy(buffer.begin(), buffer.end(),
binary_ostream_iterator<char>(ostream));

* << and >> operators for string types

The stream classes now only support fundamental data types. I am not sure
how and wether to handle strings. For example, a regular char* string can
be output as a null terminated array of char's, or as a size and a non
null-terminated array of char's. Although I prefer the first solution (more
portable, no problems with the size of the size type in the second
solution), I am not sure if the library should make such a decision.

* compression

I am also planning on adding a compressing_streambuf class, that can be used
in both the IOStreams and the binary_iostreams library.

* design

I agree with a lot of the comments on design of I/O libraries in the
previous posts. However, I do not have the time to design and implement an
improved I/O system for C++, and until such a system exists, I am convinced
that binary_iostreams should be as close as possible mimic the existing std
IOStreams library.

* Updated URL's:

Direct link to a motivating example:
http://www.cs.kuleuven.ac.be/~ares/binary_iostreams/test.cpp

The library:
http://www.cs.kuleuven.ac.be/~ares/binary_iostreams/binary_iostreams-0.11.tar.gz

The documentation:
http://www.cs.kuleuven.ac.be/~ares/binary_iostreams/doc/

Best regards,

--
Ares Lagae
Computer Graphics Research Group, Katholieke Universiteit Leuven
http://www.cs.kuleuven.be/~ares/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk