Boost logo

Boost :

Subject: Re: [boost] [locale] Review: Tutorial
From: Artyom (artyomtnk_at_[hidden])
Date: 2011-04-18 16:58:16


> From: Gevorg Voskanyan <v_gevorg_at_[hidden]>
> > > or a "class bigint" example which uses the Boost.Locale number
> > > formatting info for its I/O.
> > > Bonus points if they fallback to std facets if
> > > corresponding Boost.Locale info is missing from the stream!
> >
> > Actually it is not quite possible, at least with ICU backend as
> > it supports only double, int32 and int64 types, so it wouldn't
> > be possible to do it.
>
>
> I'd consider it a severe limitation if that is really impossible. Can't I
>print
>
> my arbitrary big integers in the properly localized way? ICU obviously knows
>the
>
> rules for formatting numbers in the locales it supports, and uses that info to
>
> format double, int32, int64. Isn't there a way to query that necessary info
>from
>
> ICU to format numbers outside of it?
>
> > It can be done somehow for non-ICU backends that provide std::numpunct,
>
>
> Are you saying here that a std::numpunct-like facet can't be implemented with

> the ICU backend?
>
> > (it is not enough for ICU case as it is too primitive to handle
> > all required options)
>
>
> Yes, I understand that std::numpunct interface is not good enough for all
> locales. What I would like to see in Boost.Locale is a facet much like
>numpunct
>
> but such that it is correct for all locales, and uses ICU to achieve that when
>
> that backend is enabled. Of course if that is possible at all?
>

The biggest problem is that ICU has rule based
number formatting and unless you parse rules specifically
you don't get what you need.

Basically it is not obvious to get the separator
rules and other things.

So in order to do it it requires re-implement icu::DecimalFormat.

Artyom


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