OSDN Git Service

* zipfile.h (ZipDirectory): Declare size, uncompressed_size,
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / docs / html / 22_locale / ctype.html
1 <HTML>
2 <HEAD>
3   <H1>
4   Notes on the ctype implementation.
5   </H1>
6 </HEAD>
7 <I>
8 prepared by Benjamin Kosnik (bkoz@redhat.com) on August 30, 2000
9 </I>
10
11 <P>
12 <H2>
13 1. Abstract
14 </H2>
15 <P>
16 Woe is me.
17 </P>
18
19 <P>
20 <H2>
21 2. What the standard says
22 </H2>
23
24
25 <P>
26 <H2>
27 3. Problems with &quot;C&quot; ctype : global locales, termination.
28 </H2>
29
30 <P>
31 For the required specialization codecvt&lt;wchar_t, char, mbstate_t&gt; ,
32 conversions are made between the internal character set (always UCS4
33 on GNU/Linux) and whatever the currently selected locale for the
34 LC_CTYPE category implements.
35
36 <P>
37 <H2>
38 4. Design
39 </H2>
40 The two required specializations are implemented as follows:
41
42 <P>
43 <TT>
44 ctype&lt;char&gt;
45 </TT>
46 <P>
47 This is simple specialization. Implementing this was a piece of cake.
48
49 <P>
50 <TT>
51 ctype&lt;wchar_t&gt;
52 </TT>
53 <P>
54 This specialization, by specifying all the template parameters, pretty
55 much ties the hands of implementors. As such, the implementation is
56 straightforward, involving mcsrtombs for the conversions between char
57 to wchar_t and wcsrtombs for conversions between wchar_t and char.
58
59 <P>
60 Neither of these two required specializations deals with Unicode
61 characters. As such, libstdc++-v3 implements 
62
63
64
65 <P>
66 <H2>
67 5.  Examples
68 </H2>
69
70 <pre>
71   typedef ctype<char> cctype;
72 </pre>
73
74 More information can be found in the following testcases:
75 <UL>
76 <LI> testsuite/22_locale/ctype_char_members.cc 
77 <LI> testsuite/22_locale/ctype_wchar_t_members.cc 
78 </UL>
79
80 <P>
81 <H2>
82 6.  Unresolved Issues
83 </H2>
84
85 <UL>
86         <LI> how to deal with the global locale issue?
87
88         <LI> how to deal with different types than char, wchar_t?
89
90         <LI> codecvt/ctype overlap: narrow/widen
91
92         <LI> mask typedef in codecvt_base, argument types in codecvt.
93         what is know about this type?
94
95         <LI> why mask* argument in codecvt?
96         
97         <LI> can this be made (more) generic? is there a simple way to
98         straighten out the configure-time mess that is a by-product of
99         this class?
100
101         <LI> get the ctype<wchar_t>::mask stuff under control. Need to
102         make some kind of static table, and not do lookup evertime
103         somebody hits the do_is... functions. Too bad we can't just
104         redefine mask for ctype<wchar_t>
105         
106         <LI> rename abstract base class. See if just smash-overriding
107         is a better approach. Clarify, add sanity to naming.
108
109 </UL>
110
111
112 <P>
113 <H2>
114 7. Acknowledgments
115 </H2>
116 Ulrich Drepper for patient answering of late-night questions, skeletal
117 examples, and C language expertise.
118
119 <P>
120 <H2>
121 8. Bibliography / Referenced Documents
122 </H2>
123
124 Drepper, Ulrich, GNU libc (glibc) 2.2 manual. In particular, Chapters &quot;6. Character Set Handling&quot; and &quot;7 Locales and Internationalization&quot;
125
126 <P>
127 Drepper, Ulrich, Numerous, late-night email correspondence
128
129 <P>
130 ISO/IEC 14882:1998 Programming languages - C++
131
132 <P>
133 ISO/IEC 9899:1999 Programming languages - C
134
135 <P>
136 Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000
137
138 <P>
139 Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000
140
141 <P>
142 System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x)
143 The Open Group/The Institute of Electrical and Electronics Engineers, Inc.
144 http://www.opennc.org/austin/docreg.html
145
146