aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/docs/html/22_locale/locale.html
blob: 630f59986f162f3e92efb9b753b3fc63cbbd56b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title>
  Notes on the locale implementation.
  </title>
</head>
<body>
  <h1>
  Notes on the locale implementation.
  </h1>
<I>
prepared by Benjamin Kosnik (bkoz@redhat.com) on August 8, 2001
</I>

<p>
<h2>
1. Abstract Describes the basic locale object, including nested
classes id, facet, and the reference-counted implementation object,
class _Impl.
</h2>
<p>
</p>

<p>
<h2>
2. What the standard says
See Chapter 22 of the standard.
</h2>


<p>
<h2>
3. Problems with &quot;C&quot; locales : global locales, termination.
</h2>

<p>
The major problem is fitting an object-orientated and non-global locale
design ontop of POSIX and other relevant stanards, which include the
Single Unix (nee X/Open.)

Because POSIX falls down so completely, portibility is an issue.
<p>

<h2>
4. Design
</h2>
Class locale in non-templatized and has three distinct types nested
inside of it:

class facet
22.1.1.1.2 Class locale::facet

Facets actually implement locale functionality. For instance, a facet
called numpunct is the data objects that can be used to query for the
thousands separator is in the German locale.

Literally, a facet is strictly defined:
 - containing 
public:
  static locale::id id;

- or derived from another facet

The only other thing of interest in this class is the memory
management of facets. Each constructor of a facet class takes a
std::size_t __refs argument: if __refs == 0, the facet is deleted when
no longer used. if __refs == 1, the facet is not destroyed, even when
it is no longer reference.


class id
Provides an index for looking up specific facets.

class _Impl

<p>
<h2>
5.  Examples
</h2>

<pre>
  typedef __locale_t locale;
</pre>

More information can be found in the following testcases:
<ul>
<li> testsuite/22_locale/ctype_char_members.cc 
<li> testsuite/22_locale/ctype_wchar_t_members.cc 
</ul>

<p>
<h2>
6.  Unresolved Issues
</h2>

<ul>
	<li> locale -a displays available locales on linux

	<li> locale initialization: at what point does _S_classic,
	_S_global get initialized? Can named locales assume this
	initialization has already taken place?

	<li> document how named locales error check when filling data
	members. Ie, a fr_FR locale that doesn't have
	numpunct::truename(): does it use "true"? Or is it a blank
	string? What's the convention?

	<li> explain how locale aliasing happens. When does "de_DE"
	use "de" information? What is the rule for locales composed of
	just an ISO language code (say, "de") and locales with both an
	ISO language code and ISO country code (say, "de_DE").

	<li> what should non-required facet instantiations do?  If the
	generic implemenation is provided, then how to end-users
	provide specializations?
</ul>

<p>
<h2>
7. Acknowledgments
</h2>

<p>
<h2>
8. Bibliography / Referenced Documents
</h2>

Drepper, Ulrich, GNU libc (glibc) 2.2 manual. In particular, Chapters &quot;6. Character Set Handling&quot; and &quot;7 Locales and Internationalization&quot;

<p>
Drepper, Ulrich, Numerous, late-night email correspondence

<p>
ISO/IEC 14882:1998 Programming languages - C++

<p>
ISO/IEC 9899:1999 Programming languages - C

<p>
Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000

<p>
Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000

<p>
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x)
The Open Group/The Institute of Electrical and Electronics Engineers, Inc.
http://www.opennc.org/austin/docreg.html