Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
_collate.h
Go to the documentation of this file.
1
32#ifndef _RWSTD_LOC_COLLATE_H_INCLUDED
33#define _RWSTD_LOC_COLLATE_H_INCLUDED
34
35
36#if __GNUG__ >= 3
37# pragma GCC system_header
38#endif // gcc >= 3
39
40
41#include <string>
42#include <loc/_facet.h>
43#include <rw/_defs.h>
44
45
47
48
50template <class _CharT>
51class collate;
52
53
54#ifndef _RWSTD_NO_EXT_COLLATE_PRIMARY
55
57template <class _CharT>
58class collate: public _RW::__rw_facet
59{
60public:
61 typedef _CharT char_type;
62 typedef basic_string<char_type, char_traits<char_type>,
63 allocator<char_type> >
64 string_type;
65
66 explicit collate (_RWSTD_SIZE_T __refs = 0)
67 : _RW::__rw_facet (__refs) { }
68
69 virtual ~collate () _RWSTD_ATTRIBUTE_NOTHROW;
70
71 int
72 compare (const char_type* __low1, const char_type* __high1,
73 const char_type* __low2, const char_type* __high2) const {
74 return do_compare (__low1, __high1, __low2, __high2);
75 }
76
77 string_type
78 transform (const char_type* __low, const char_type* __high) const {
79 return do_transform (__low, __high);
80 }
81
82 long
83 hash (const char_type* __low, const char_type* __high) const {
84 return do_hash (__low, __high);
85 }
86
87 static _RW::__rw_facet_id id;
88
89protected:
90
91 // protected virtual members are not defined
92 virtual int
93 do_compare (const char_type*, const char_type*,
94 const char_type*, const char_type*) const;
95
96 virtual string_type
97 do_transform (const char_type*, const char_type*) const;
98
99 virtual long
100 do_hash (const char_type*, const char_type*) const;
101};
102
103#endif // _RWSTD_NO_EXT_COLLATE_PRIMARY
104
105
107class _RWSTD_EXPORT collate<char>: public _RW::__rw_facet
108{
109public:
110 typedef char char_type;
111 typedef basic_string<char_type, char_traits<char_type>,
112 allocator<char_type> >
113 string_type;
114
115 explicit collate (_RWSTD_SIZE_T __refs = 0)
116 : _RW::__rw_facet (__refs) { }
117
118 virtual ~collate () _RWSTD_ATTRIBUTE_NOTHROW;
119
120 int
121 compare (const char_type* __low1, const char_type* __high1,
122 const char_type* __low2, const char_type* __high2) const {
123 return do_compare (__low1, __high1, __low2, __high2);
124 }
125
126 string_type
127 transform (const char_type* __low, const char_type* __high) const {
128 return do_transform (__low, __high);
129 }
130
131 long
132 hash (const char_type* __low, const char_type* __high) const {
133 return do_hash (__low, __high);
134 }
135
136 static _RW::__rw_facet_id id;
137
138protected:
139
140 virtual int
141 do_compare (const char_type*, const char_type*,
142 const char_type*, const char_type*) const;
143
144 virtual string_type
145 do_transform (const char_type*, const char_type*) const;
146
147 virtual long
148 do_hash (const char_type*, const char_type*) const;
149};
150
151
152#ifndef _RWSTD_NO_WCHAR_T
153
155class _RWSTD_EXPORT collate<wchar_t>: public _RW::__rw_facet
156{
157public:
158 typedef wchar_t char_type;
159 typedef basic_string<char_type, char_traits<char_type>,
160 allocator<char_type> >
161 string_type;
162
163 explicit collate (_RWSTD_SIZE_T __refs = 0) _THROWS (())
164 : _RW::__rw_facet (__refs) { }
165
166 virtual ~collate () _RWSTD_ATTRIBUTE_NOTHROW;
167
168 int
169 compare (const char_type* __low1, const char_type* __high1,
170 const char_type* __low2, const char_type* __high2) const {
171 return do_compare (__low1, __high1, __low2, __high2);
172 }
173
174 string_type
175 transform (const char_type* __low, const char_type* __high) const {
176 return do_transform (__low, __high);
177 }
178
179 long
180 hash (const char_type* __low, const char_type* __high) const {
181 return do_hash (__low, __high);
182 }
183
184 static _RW::__rw_facet_id id;
185
186protected:
187
188 virtual int
189 do_compare (const char_type*, const char_type*,
190 const char_type*, const char_type*) const;
191
192 virtual string_type
193 do_transform (const char_type*, const char_type*) const;
194
195 virtual long
196 do_hash (const char_type*, const char_type*) const;
197};
198
199#endif // _RWSTD_NO_WCHAR_T
200
201
202template <class _CharT>
203class collate_byname: public collate<_CharT>
204{
205 char _C_namebuf [32];
206
207public:
208
209 explicit collate_byname (const char *__name, _RWSTD_SIZE_T __ref = 0)
210 : collate<_CharT>(__ref) {
211 this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
212 }
213};
214
215
217class _RWSTD_EXPORT collate_byname<char>: public collate<char>
218{
219 char _C_namebuf [32];
220public:
221
222 explicit collate_byname (const char* __name, _RWSTD_SIZE_T __ref = 0)
223 : collate<char_type>(__ref){
224 this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
225 }
226
227 virtual ~collate_byname () _RWSTD_ATTRIBUTE_NOTHROW;
228
229protected:
230
231 virtual int
232 do_compare (const char_type*, const char_type*,
233 const char_type*, const char_type*) const;
234
235 virtual string_type
236 do_transform (const char_type*, const char_type*) const;
237};
238
239
240#ifndef _RWSTD_NO_WCHAR_T
241
243class _RWSTD_EXPORT collate_byname<wchar_t>: public collate<wchar_t>
244{
245 char _C_namebuf [32];
246public:
247
248 explicit collate_byname (const char* __name, _RWSTD_SIZE_T __ref = 0)
249 : collate<char_type>(__ref){
250 this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
251 }
252
253 virtual ~collate_byname () _RWSTD_ATTRIBUTE_NOTHROW;
254
255protected:
256
257 virtual int
258 do_compare (const char_type*, const char_type*,
259 const char_type*, const char_type*) const;
260
261 virtual string_type
262 do_transform (const char_type*, const char_type*) const;
263};
264
265#endif // _RWSTD_NO_WCHAR_T
266
267} // namespace std
268
269
270#if _RWSTD_DEFINE_TEMPLATE (_COLLATE)
271# include <loc/_collate.cc>
272#endif // _RWSTD_DEFINE_TEMPLATE (_COLLATE)
273
274
275#endif // _RWSTD_LOC_COLLATE_H_INCLUDED
#define _RWSTD_SPECIALIZED_CLASS
#define _THROWS()
unsigned short wchar_t
#define _RWSTD_EXPORT
Definition _defs.h:485
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567
#define _RWSTD_ATTRIBUTE_NOTHROW
Definition _defs.h:1179
#define _EXPORT
Definition _defs.h:498
Definition json.h:5363