Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2004-09-29 10:45:21


On Tue, 28 Sep 2004 09:23:40 +0000 (UTC), Martin wrote

> > Yes we realize this is a pain. The plan is to provide manipulators to
> control
> > these aspects so you don't have to mess with the facet to control seperators
> > and ordering.
>
> Maybe it is just me but I prefer the facet way since then I can
> apply it either globally or to a specific stream. With manipulators
> there is no way to control the date format used in e.g. the program
> options library.

Hmm, good point.
 
> Why not create a facet which uses the standard strftime formatters
> and also lets you use custom names for days & months. If %a,%b etc
> is specified just check if custom names are available, otherwise let
> the standard time_put::put
> () (or strftime) handle it. %c,%x & %X should always be handled by time_put.
>
> With this facet you can do:
> xmlstream.imbue(locale(locale::classic(), new date_time_facet("%Y-%m-
> %dT%H:%M:% S")));

Well, I've been resisting this, but I agree this is pretty compelling. My
main resistance has been that I suspect the implementation will be pretty
difficult and well, I can never remember what those darn %M things mean anyway.

> Parsing date input is always tricky but isn't that a reason to have
> it as a library function.

Yes.

> Different facets or constructor overloads is probably needed to
> handle different cases like only date, only time & intervals.

Given that the input is a string it will probably require different facets.

> I can help with implementation if you like.

If you are willing to help, let's explore it. My sense of this is that it is
alot of work. But, send me some mail offline and we can get started.

Jeff


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