Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2003-09-06 15:44:28


Date: Fri, 05 Sep 2003 16:51:05 -0400
From: Beman Dawes <bdawes_at_[hidden]>
To: Boost mailing list <>, boost_at_[hidden]
Subject: Re: [boost] Re:
Message-ID: <4.3.2.7.2.20030905164535.01536750_at_[hidden]>
In-Reply-To: <bjamm3$fqp$1_at_[hidden]>
References: <01C37204.AC7CC6C0_at_[hidden]>
Content-Type: text/plain; charset="us-ascii"; format=flowed
MIME-Version: 1.0
Precedence: list
Message: 3

Beman Dawes wrote:

>>"utf8_codecvt_facet.hpp".

>This sounds useful well beyond the serialization library. For example, it
>will be a "must have" for the filesystem library to be able to deal with
>wide character paths with a user supplied conversion.

>What namespace and header sub-directory are you proposing? Will it be
>documented separately?

Right now is in boost::archive (boost/archive). I lifted it in toto from the
boost files section. It was written by Ron Garcia. I just made changes
necessary to make it work in my context - not many as I recall. I
do remember that there where loose ends unaddressed. e.g. wide
chars on gcc are 4 bytes while on 2 bytes on other platforms.
The documention in the serialization library is just the documentation
page include along with the module.

Obviously the serializatoin of XML is only one instance of the
applicability of this function so it should be should be considered
separately for official inclusion into boost.

By the way, There is other code that should be given the same
consideration:

state_saver - this is a generalization of the io_state_saver
implemented by Darly Walker. At first I wasn't inclinded to
use itas it seemed to replace so little code. But as the
need cropped in a couple of cases, I came to feel that
its way under used. In fact, I came to like it so much
I generalized the idea in to a generalized state_saver
which was very useful in avoid stupid little mistakes
that are excruciatingly difficult to find. In fact it was
in finding one of those exact mistakes that motivated
me to make the state_saver. This should also be
considered separatly for boost.

buffered iterator adaptorss. They really should be called filter
iterator adaptor(already take) or pipe iterator adaptor. Basically
they the have the folowing features.

a) a kind of iterator adaptor
b) overload of preincrement operator
c) default constructor produces an iterator equal to end().

The can be composed to any reasonable depth like unix pipes.
They are used in the serialization library to build things like
transators from multi-byte strings of a particular locale to
widecharacter strings in escaped html all in one pass. Unfortunately
the implementation was done just before the new iterator adaptors
were released and I didn't want to stop moving forward. I understand
that multi-pass has been converted to the new interatorator adaptor.
The implemenation included in the serialization library is - a - sort
of - a hack ? - but it works well and demonstrates the wide applicability
of the concept. I challange someone to take this code (found in
buffered_iterators.hpp and test_iterators.hpp) and convert it
to the new iterator adaptors in a robust and complete way.
While your at it include a couple of useful things like cat for
concatoning two iterators ( I believe something like this is
already in the files section)

Finally, BOOST_STATIC_WARNING should be considered.
This turns out to be highly compiler dependent but worth
the effort in my opinion. I made for msvc but the version
doesn't work with gcc. In my opinion this is very doable
and very useful as well.

As I said before, the versions in the serialization library
do work but could benefit from being more formal, robust,
and general. Taking them out of the serialization library
and making them stand alone would also make the
serialization library smaller. This would be a very good
thing.

Robert Ramey


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