Topic: how does a facet refer to its locale?
Author: Marcus Barnes <marcus_aurelius@my-deja.com>
Date: 2000/07/19 Raw View
In article <8l1dot$flg$1@nnrp1.deja.com>,
Dietmar Kuehl <dietmar_kuehl@yahoo.com> wrote:
>
> String collation and character classification are completely separated
> and there is no association between them. Correspondingly there is no
> way to access a facet from the same locale. This applies to all
> facets, not just to the 'ctype' and 'collate' facets.
Thanks Dietmar,
I've come to the same conclusion. However I see this as a practical
deficiency in the design.
My use case is that I derive from std::collate in order to implement a
case insentive compare method. Therefore I access std::ctype::tolower to
perform the transform. This seems correct in concept. If I don't use the
same locale the operation looses coherency and may result in a
conversion error (like converting between code pages).
As you describe, numget and numput have this additional coherency via an
ios_base parameter. That this type of mechanism isn't generally applied
across all facets seems (to me) to be a design flaw.
Any help writing a case insensitive collate::compare() as described
above is greatly appreciated.
--
Regards, Marcus
Sent via Deja.com http://www.deja.com/
Before you buy.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Marcus Barnes <marcus_aurelius@my-deja.com>
Date: 2000/07/18 Raw View
Hi All,
I've derived a class from the standard collate facet. Within its
implementation I need to refer to the locale the facet is bound to, in
order to access the associated ctype facet. I don't see a way to do
this. The facet constructor doesn't take a locale for example.
How is this type of derivation done properly?
--
Regards, Marcus
Sent via Deja.com http://www.deja.com/
Before you buy.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Dietmar Kuehl <dietmar_kuehl@yahoo.com>
Date: 2000/07/19 Raw View
Hi,
In article <8l09ki$mb7$1@nnrp1.deja.com>,
Marcus Barnes <marcus_aurelius@my-deja.com> wrote:
> I've derived a class from the standard collate facet. Within its
> implementation I need to refer to the locale the facet is bound to, in
> order to access the associated ctype facet. I don't see a way to do
> this. The facet constructor doesn't take a locale for example.
String collation and character classification are completely separated
and there is no association between them. Correspondingly there is no
way to access a facet from the same locale. This applies to all facets,
not just to the 'ctype' and 'collate' facets. In some situations a
different facet is used to determine additional properties. In this
situation a locale is passed somehow to the corresponding methods, eg.
in case of the numeric facets (ie. 'num_put' and 'num_get') the methods
get passed in an 'ios_base' object from which additional facets (mainly
'numpunct' and 'ctype') are determined.
--
<mailto:dietmar_kuehl@yahoo.com>
<http://www.dietmar-kuehl.de/>
Sent via Deja.com http://www.deja.com/
Before you buy.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]