3 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
4 <meta name="AUTHOR" content="bkoz@redhat.com (Benjamin Kosnik)" />
5 <meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL" />
6 <meta name="DESCRIPTION" content="Notes on the locale implementation." />
7 <title>Notes on the locale implementation.</title>
8 <link rel="StyleSheet" href="../lib3styles.css" />
12 Notes on the locale implementation.
15 prepared by Benjamin Kosnik (bkoz@redhat.com) on August 8, 2001
19 1. Abstract Describes the basic locale object, including nested
20 classes id, facet, and the reference-counted implementation object,
27 2. What the standard says
29 See Chapter 22 of the standard.
33 3. Problems with "C" locales : global locales, termination.
37 The major problem is fitting an object-orientated and non-global locale
38 design ontop of POSIX and other relevant stanards, which include the
39 Single Unix (nee X/Open.)
41 Because POSIX falls down so completely, portibility is an issue.
47 Class locale in non-templatized and has three distinct types nested
51 22.1.1.1.2 Class locale::facet
53 Facets actually implement locale functionality. For instance, a facet
54 called numpunct is the data objects that can be used to query for the
55 thousands separator is in the German locale.
57 Literally, a facet is strictly defined:
62 - or derived from another facet
64 The only other thing of interest in this class is the memory
65 management of facets. Each constructor of a facet class takes a
66 std::size_t __refs argument: if __refs == 0, the facet is deleted when
67 no longer used. if __refs == 1, the facet is not destroyed, even when
68 it is no longer reference.
72 Provides an index for looking up specific facets.
81 typedef __locale_t locale;
84 More information can be found in the following testcases:
86 <li> testsuite/22_locale/ctype_char_members.cc </li>
87 <li> testsuite/22_locale/ctype_wchar_t_members.cc </li>
95 <li> locale -a displays available locales on linux </li>
97 <li> locale initialization: at what point does _S_classic,
98 _S_global get initialized? Can named locales assume this
99 initialization has already taken place? </li>
101 <li> document how named locales error check when filling data
102 members. Ie, a fr_FR locale that doesn't have
103 numpunct::truename(): does it use "true"? Or is it a blank
104 string? What's the convention? </li>
106 <li> explain how locale aliasing happens. When does "de_DE"
107 use "de" information? What is the rule for locales composed of
108 just an ISO language code (say, "de") and locales with both an
109 ISO language code and ISO country code (say, "de_DE"). </li>
111 <li> what should non-required facet instantiations do? If the
112 generic implemenation is provided, then how to end-users
113 provide specializations? </li>
121 8. Bibliography / Referenced Documents
124 Drepper, Ulrich, GNU libc (glibc) 2.2 manual. In particular, Chapters "6. Character Set Handling" and "7 Locales and Internationalization"
127 Drepper, Ulrich, Numerous, late-night email correspondence
131 ISO/IEC 14882:1998 Programming languages - C++
135 ISO/IEC 9899:1999 Programming languages - C
139 Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000
143 Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000
147 System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x)
148 The Open Group/The Institute of Electrical and Electronics Engineers, Inc.
149 http://www.opennc.org/austin/docreg.html