1 : // iosfwd standard header
2 : #pragma once
3 : #ifndef _IOSFWD_
4 : #define _IOSFWD_
5 : #ifndef RC_INVOKED
6 : #include <cstdio>
7 : #include <cstring>
8 : #include <cwchar>
9 : #include <xstddef>
10 : #include <crtdbg.h>
11 :
12 : #ifdef _MSC_VER
13 : #pragma pack(push,_CRT_PACKING)
14 : #pragma warning(push,3)
15 : #endif /* _MSC_VER */
16 : _STD_BEGIN
17 :
18 : // STREAM POSITIONING TYPES (from <streambuf>)
19 : #ifdef _WIN64
20 : typedef __int64 streamoff;
21 : typedef __int64 streamsize;
22 :
23 : #else /* _WIN64 */
24 : typedef long streamoff;
25 : typedef int streamsize;
26 : #endif /* _WIN64 */
27 :
28 : #if defined(_FSEEK_OFF)
29 :
30 : #elif defined(_WIN64)
31 : #define _FSEEK_OFF(str, off, way) fseek(str, off, way)
32 :
33 : #else /* _WIN64 */
34 : #define _FSEEK_OFF(str, off, way) _fseeki64(str, off, way)
35 : #endif /* _WIN64 */
36 :
37 : #ifdef _M_CEE_PURE
38 : extern fpos_t& _Fpz;
39 : extern const streamoff& _BADOFF;
40 : #else
41 : extern _CRTDATA2 _PGLOBAL fpos_t _Fpz;
42 : extern _CRTDATA2 _PGLOBAL const streamoff _BADOFF;
43 : #endif
44 :
45 : // TEMPLATE CLASS fpos (from <streambuf>)
46 : template<class _Statetype>
47 : class fpos
48 : { // store arbitrary file position
49 : typedef fpos<_Statetype> _Myt;
50 :
51 : public:
52 : __CLR_OR_THIS_CALL fpos(streamoff _Off = 0)
53 : : _Myoff(_Off), _Fpos(0), _Mystate(_Stz)
54 0 : { // construct with stream offset
55 0 : }
56 :
57 : __CLR_OR_THIS_CALL fpos(_Statetype _State, fpos_t _Fileposition)
58 : : _Myoff(0), _Fpos(_Fileposition), _Mystate(_State)
59 : { // construct with conversion state and C file position
60 : }
61 :
62 : _Statetype __CLR_OR_THIS_CALL state() const
63 : { // return conversion state
64 : return (_Mystate);
65 : }
66 :
67 : void __CLR_OR_THIS_CALL state(_Statetype _State)
68 : { // set conversion state
69 : _Mystate = _State;
70 : }
71 :
72 : fpos_t __CLR_OR_THIS_CALL seekpos() const
73 : { // return C file position
74 : return (_Fpos);
75 : }
76 :
77 : __CLR_OR_THIS_CALL operator streamoff() const
78 0 : { // return offset
79 0 : return ((streamoff)(_Myoff + _FPOSOFF(_Fpos)));
80 0 : }
81 :
82 : streamoff __CLR_OR_THIS_CALL operator-(const _Myt& _Right) const
83 : { // return difference of file positions as an offset
84 : return ((streamoff)*this - (streamoff)_Right);
85 : }
86 :
87 : _Myt& __CLR_OR_THIS_CALL operator+=(streamoff _Off)
88 : { // add offset
89 : _Myoff += _Off;
90 : return (*this);
91 : }
92 :
93 : _Myt& __CLR_OR_THIS_CALL operator-=(streamoff _Off)
94 : { // subtract offset
95 : _Myoff -= _Off;
96 : return (*this);
97 : }
98 :
99 : _Myt __CLR_OR_THIS_CALL operator+(streamoff _Off) const
100 : { // return this + offset
101 : _Myt _Tmp = *this;
102 : return (_Tmp += _Off);
103 : }
104 :
105 : _Myt __CLR_OR_THIS_CALL operator-(streamoff _Off) const
106 : { // return this - offset
107 : _Myt _Tmp = *this;
108 : return (_Tmp -= _Off);
109 : }
110 :
111 : bool __CLR_OR_THIS_CALL operator==(const _Myt& _Right) const
112 : { // test for file position equality
113 : return ((streamoff)*this == (streamoff)_Right);
114 : }
115 :
116 : bool __CLR_OR_THIS_CALL operator!=(const _Myt& _Right) const
117 : { // test for file position inequality
118 : return (!(*this == _Right));
119 : }
120 :
121 : private:
122 : _PGLOBAL static const _Statetype _Stz; // initial conversion state
123 : streamoff _Myoff; // stream offset
124 : fpos_t _Fpos; // C file position
125 : _Statetype _Mystate; // current conversion state
126 : };
127 :
128 : // STATIC fpos::_Stz OBJECT
129 : template<class _Statetype>
130 : _PGLOBAL const _Statetype fpos<_Statetype>::_Stz = _Statetype();
131 :
132 : #define _POS_TYPE_FROM_STATE(postype, state, position) \
133 : postype(state, position)
134 : #define _POS_TYPE_TO_FPOS_T(pos) pos.seekpos()
135 : #define _POS_TYPE_TO_STATE(pos) pos.state()
136 :
137 : typedef fpos<_Mbstatet> streampos;
138 : typedef streampos wstreampos;
139 :
140 : // SECURE CHAR TRAITS TAGS
141 : struct _Unsecure_char_traits_tag
142 : {
143 : };
144 : struct _Secure_char_traits_tag
145 : {
146 : };
147 :
148 : // TEMPLATE STRUCT _Char_traits_base
149 : // Used to define the Secure_char_traits tag. This typedef is used
150 : // only for user defined char_traits. A user defined char_traits should
151 : // inherit from _Char_traits_base, define _Secure_char_traits as
152 : // _Secure_char_traits_tag and implement _Copy_s and _Move_s.
153 : struct _Char_traits_base
154 : {
155 : typedef _Unsecure_char_traits_tag _Secure_char_traits;
156 : };
157 :
158 : // TEMPLATE STRUCT char_traits (FROM <string>)
159 : // char_traits classes implement _Copy_s and _Move_s and are
160 : // automatically recognized as secure by string_base.
161 : template<class _Elem>
162 : struct char_traits:
163 : public _Char_traits_base
164 : { // properties of a string or stream element
165 : typedef _Elem char_type;
166 : typedef long int_type;
167 : typedef streampos pos_type;
168 : typedef streamoff off_type;
169 : typedef _Mbstatet state_type;
170 :
171 : static void __CLRCALL_OR_CDECL assign(_Elem& _Left, const _Elem& _Right)
172 : { // assign an element
173 : _Left = _Right;
174 : }
175 :
176 : static bool __CLRCALL_OR_CDECL eq(const _Elem& _Left, const _Elem& _Right)
177 : { // test for element equality
178 : return (_Left == _Right);
179 : }
180 :
181 : static bool __CLRCALL_OR_CDECL lt(const _Elem& _Left, const _Elem& _Right)
182 : { // test if _Left precedes _Right
183 : return (_Left < _Right);
184 : }
185 :
186 : static int __CLRCALL_OR_CDECL compare(_In_count_(_Count) const _Elem *_First1,
187 : _In_count_(_Count) const _Elem *_First2, size_t _Count)
188 : { // compare [_First1, _First1 + _Count) with [_First2, ...)
189 : // _DEBUG_POINTER(_First1);
190 : // _DEBUG_POINTER(_First2);
191 : for (; 0 < _Count; --_Count, ++_First1, ++_First2)
192 : if (!eq(*_First1, *_First2))
193 : return (lt(*_First1, *_First2) ? -1 : +1);
194 : return (0);
195 : }
196 :
197 : static size_t __CLRCALL_OR_CDECL length(_In_z_ const _Elem *_First)
198 : { // find length of null-terminated sequence
199 : // _DEBUG_POINTER(_First);
200 : size_t _Count;
201 : for (_Count = 0; !eq(*_First, _Elem()); ++_First)
202 : ++_Count;
203 : return (_Count);
204 : }
205 :
206 : _SCL_INSECURE_DEPRECATE
207 : static _Elem *__CLRCALL_OR_CDECL copy(_Out_cap_(_Count) _Elem *_First1,
208 : _In_count_(_Count) const _Elem *_First2, size_t _Count)
209 : { // copy [_First1, _First1 + _Count) to [_First2, ...)
210 : // assume there is enough space in the destination buffer
211 : return _Copy_s(_First1, _Count, _First2, _Count);
212 : }
213 :
214 : static _Elem *__CLRCALL_OR_CDECL _Copy_s(_Out_cap_(_Dest_size) _Elem *_First1, size_t _Dest_size,
215 : _In_count_(_Count) const _Elem *_First2, size_t _Count)
216 : { // copy [_First1, _First1 + _Count) to [_First2, ...)
217 : // _DEBUG_POINTER(_First1);
218 : // _DEBUG_POINTER(_First2);
219 : _SCL_SECURE_CRT_VALIDATE(_Dest_size >= _Count, NULL);
220 : _Elem *_Next = _First1;
221 : for (; 0 < _Count; --_Count, ++_Next, ++_First2)
222 : assign(*_Next, *_First2);
223 : return (_First1);
224 : }
225 :
226 : static const _Elem *__CLRCALL_OR_CDECL find(_In_count_(_Count) const _Elem *_First,
227 : size_t _Count, const _Elem& _Ch)
228 : { // look for _Ch in [_First, _First + _Count)
229 : // _DEBUG_POINTER(_First);
230 : for (; 0 < _Count; --_Count, ++_First)
231 : if (eq(*_First, _Ch))
232 : return (_First);
233 : return (0);
234 : }
235 :
236 : _SCL_INSECURE_DEPRECATE
237 : static _Elem *__CLRCALL_OR_CDECL move(_Out_cap_(_Count) _Elem *_First1,
238 : _In_count_(_Count) const _Elem *_First2, size_t _Count)
239 : { // move [_First1, _First1 + _Count) to [_First2, ...)
240 : // assume there is enough space in the destination buffer
241 : return _Move_s(_First1, _Count, _First2, _Count);
242 : }
243 :
244 : static _Elem *__CLRCALL_OR_CDECL _Move_s(_Out_cap_(_Dest_size) _Elem *_First1, size_t _Dest_size,
245 : _In_count_(_Count) const _Elem *_First2, size_t _Count)
246 : { // move [_First1, _First1 + _Count) to [_First2, ...)
247 : // _DEBUG_POINTER(_First1);
248 : // _DEBUG_POINTER(_First2);
249 : _SCL_SECURE_CRT_VALIDATE(_Dest_size >= _Count, NULL);
250 : _Elem *_Next = _First1;
251 : if (_First2 < _Next && _Next < _First2 + _Count)
252 : for (_Next += _Count, _First2 += _Count; 0 < _Count; --_Count)
253 : assign(*--_Next, *--_First2);
254 : else
255 : for (; 0 < _Count; --_Count, ++_Next, ++_First2)
256 : assign(*_Next, *_First2);
257 : return (_First1);
258 : }
259 :
260 : static _Elem *__CLRCALL_OR_CDECL assign(_Out_cap_(_Count) _Elem *_First,
261 : size_t _Count, _Elem _Ch)
262 : { // assign _Count * _Ch to [_First, ...)
263 : // _DEBUG_POINTER(_First);
264 : _Elem *_Next = _First;
265 : for (; 0 < _Count; --_Count, ++_Next)
266 : assign(*_Next, _Ch);
267 : return (_First);
268 : }
269 :
270 : static _Elem __CLRCALL_OR_CDECL to_char_type(const int_type& _Meta)
271 : { // convert metacharacter to character
272 : return ((_Elem)_Meta);
273 : }
274 :
275 : static int_type __CLRCALL_OR_CDECL to_int_type(const _Elem& _Ch)
276 : { // convert character to metacharacter
277 : return ((int_type)_Ch);
278 : }
279 :
280 : static bool __CLRCALL_OR_CDECL eq_int_type(const int_type& _Left,
281 : const int_type& _Right)
282 : { // test for metacharacter equality
283 : return (_Left == _Right);
284 : }
285 :
286 : static int_type __CLRCALL_OR_CDECL eof()
287 : { // return end-of-file metacharacter
288 : return ((int_type)EOF);
289 : }
290 :
291 : static int_type __CLRCALL_OR_CDECL not_eof(const int_type& _Meta)
292 : { // return anything but EOF
293 : return (_Meta != eof() ? (int_type)_Meta : (int_type)!eof());
294 : }
295 : };
296 :
297 : // STRUCT char_traits<wchar_t>
298 : template<> struct _CRTIMP2_PURE char_traits<wchar_t>:
299 : public _Char_traits_base
300 : { // properties of a string or stream wchar_t element
301 : typedef wchar_t _Elem;
302 : typedef _Elem char_type; // for overloads
303 : typedef wint_t int_type;
304 : typedef streampos pos_type;
305 : typedef streamoff off_type;
306 : typedef _Mbstatet state_type;
307 :
308 : static void __CLRCALL_OR_CDECL assign(_Elem& _Left, const _Elem& _Right)
309 7 : { // assign an element
310 7 : _Left = _Right;
311 7 : }
312 :
313 : static bool __CLRCALL_OR_CDECL eq(const _Elem& _Left, const _Elem& _Right)
314 : { // test for element equality
315 : return (_Left == _Right);
316 : }
317 :
318 : static bool __CLRCALL_OR_CDECL lt(const _Elem& _Left, const _Elem& _Right)
319 : { // test if _Left precedes _Right
320 : return (_Left < _Right);
321 : }
322 :
323 : static int __CLRCALL_OR_CDECL compare(_In_count_(_Count) const _Elem *_First1, _In_count_(_Count) const _Elem *_First2,
324 : size_t _Count)
325 0 : { // compare [_First1, _First1 + _Count) with [_First2, ...)
326 : // _DEBUG_POINTER(_First1);
327 : // _DEBUG_POINTER(_First2);
328 0 : return (::wmemcmp(_First1, _First2, _Count));
329 0 : }
330 :
331 : static size_t __CLRCALL_OR_CDECL length(_In_z_ const _Elem *_First)
332 0 : { // find length of null-terminated sequence
333 : // _DEBUG_POINTER(_First);
334 0 : return (::wcslen(_First));
335 0 : }
336 :
337 : _SCL_INSECURE_DEPRECATE
338 : static _Elem *__CLRCALL_OR_CDECL copy(_Out_cap_(_Count) _Elem *_First1, _In_count_(_Count) const _Elem *_First2,
339 : size_t _Count)
340 : { // copy [_First1, _First1 + _Count) to [_First2, ...)
341 : // assume there is enough space in the destination buffer
342 : return _Copy_s(_First1, _Count, _First2, _Count);
343 : }
344 :
345 : static _Elem *__CLRCALL_OR_CDECL _Copy_s(_Out_cap_(_Size_in_words) _Elem *_First1, size_t _Size_in_words, _In_count_(_Count) const _Elem *_First2,
346 : size_t _Count)
347 0 : { // copy [_First1, _First1 + _Count) to [_First2, ...)
348 : // _DEBUG_POINTER(_First1);
349 : // _DEBUG_POINTER(_First2);
350 0 : _CRT_SECURE_WMEMCPY(_First1, _Size_in_words, _First2, _Count);
351 0 : return _First1;
352 0 : }
353 :
354 : static const _Elem *__CLRCALL_OR_CDECL find(_In_count_(_Count) const _Elem *_First, size_t _Count,
355 : const _Elem& _Ch)
356 0 : { // look for _Ch in [_First, _First + _Count)
357 : // _DEBUG_POINTER(_First);
358 0 : return ((const _Elem *)::wmemchr(_First, _Ch, _Count));
359 0 : }
360 :
361 : _SCL_INSECURE_DEPRECATE
362 : static _Elem *__CLRCALL_OR_CDECL move(_Out_cap_(_Count) _Elem *_First1, _In_count_(_Count) const _Elem *_First2,
363 : size_t _Count)
364 : { // move [_First1, _First1 + _Count) to [_First2, ...)
365 : // assume there is enough space in the destination buffer
366 : return _Move_s(_First1, _Count, _First2, _Count);
367 : }
368 :
369 : static _Elem *__CLRCALL_OR_CDECL _Move_s(_Out_cap_(_Size_in_words) _Elem *_First1, size_t _Size_in_words, _In_count_(_Count) const _Elem *_First2,
370 : size_t _Count)
371 0 : { // move [_First1, _First1 + _Count) to [_First2, ...)
372 : // _DEBUG_POINTER(_First1);
373 : // _DEBUG_POINTER(_First2);
374 0 : _CRT_SECURE_WMEMMOVE(_First1, _Size_in_words, _First2, _Count);
375 0 : return (_Elem *)_First1;
376 0 : }
377 :
378 : static _Elem *__CLRCALL_OR_CDECL assign(_Out_cap_(_Count) _Elem *_First, size_t _Count, _Elem _Ch)
379 0 : { // assign _Count * _Ch to [_First, ...)
380 : // _DEBUG_POINTER(_First);
381 0 : return ((_Elem *)::wmemset(_First, _Ch, _Count));
382 0 : }
383 :
384 : static _Elem __CLRCALL_OR_CDECL to_char_type(const int_type& _Meta)
385 : { // convert metacharacter to character
386 : return (_Meta);
387 : }
388 :
389 : static int_type __CLRCALL_OR_CDECL to_int_type(const _Elem& _Ch)
390 : { // convert character to metacharacter
391 : return (_Ch);
392 : }
393 :
394 : static bool __CLRCALL_OR_CDECL eq_int_type(const int_type& _Left,
395 : const int_type& _Right)
396 : { // test for metacharacter equality
397 : return (_Left == _Right);
398 : }
399 :
400 : static int_type __CLRCALL_OR_CDECL eof()
401 : { // return end-of-file metacharacter
402 : return (WEOF);
403 : }
404 :
405 : static int_type __CLRCALL_OR_CDECL not_eof(const int_type& _Meta)
406 : { // return anything but EOF
407 : return (_Meta != eof() ? _Meta : !eof());
408 : }
409 : };
410 :
411 :
412 : // STRUCT char_traits<char> (FROM <string>)
413 : template<> struct _CRTIMP2_PURE char_traits<char>:
414 : public _Char_traits_base
415 : { // properties of a string or stream char element
416 : typedef char _Elem;
417 : typedef _Elem char_type;
418 : typedef int int_type;
419 : typedef streampos pos_type;
420 : typedef streamoff off_type;
421 : typedef _Mbstatet state_type;
422 :
423 : static void __CLRCALL_OR_CDECL assign(_Elem& _Left, const _Elem& _Right)
424 13 : { // assign an element
425 13 : _Left = _Right;
426 13 : }
427 :
428 : static bool __CLRCALL_OR_CDECL eq(const _Elem& _Left, const _Elem& _Right)
429 0 : { // test for element equality
430 0 : return (_Left == _Right);
431 0 : }
432 :
433 : static bool __CLRCALL_OR_CDECL lt(const _Elem& _Left, const _Elem& _Right)
434 : { // test if _Left precedes _Right
435 : return (_Left < _Right);
436 : }
437 :
438 : static int __CLRCALL_OR_CDECL compare(_In_count_(_Count) const _Elem *_First1, _In_count_(_Count) const _Elem *_First2,
439 : size_t _Count)
440 11 : { // compare [_First1, _First1 + _Count) with [_First2, ...)
441 : // _DEBUG_POINTER(_First1);
442 : // _DEBUG_POINTER(_First2);
443 11 : return (::memcmp(_First1, _First2, _Count));
444 11 : }
445 :
446 : static size_t __CLRCALL_OR_CDECL length(_In_z_ const _Elem *_First)
447 13 : { // find length of null-terminated string
448 : // _DEBUG_POINTER(_First);
449 13 : return (::strlen(_First));
450 13 : }
451 :
452 : _SCL_INSECURE_DEPRECATE
453 : static _Elem *__CLRCALL_OR_CDECL copy(_Out_cap_(_Count) _Elem *_First1, _In_count_(_Count) const _Elem *_First2,
454 : size_t _Count)
455 : { // copy [_First1, _First1 + _Count) to [_First2, ...)
456 : // assume there is enough space in the destination buffer
457 : return _Copy_s(_First1, _Count, _First2, _Count);
458 : }
459 :
460 : static _Elem *__CLRCALL_OR_CDECL _Copy_s(_Out_cap_(_Size_in_bytes) _Elem *_First1, size_t _Size_in_bytes, _In_count_(_Count) const _Elem *_First2,
461 : size_t _Count)
462 13 : { // copy [_First1, _First1 + _Count) to [_First2, ...)
463 : // _DEBUG_POINTER(_First1);
464 : // _DEBUG_POINTER(_First2);
465 13 : _CRT_SECURE_MEMCPY(_First1, _Size_in_bytes, _First2, _Count);
466 13 : return _First1;
467 13 : }
468 :
469 : static const _Elem *__CLRCALL_OR_CDECL find(_In_count_(_Count) const _Elem *_First, size_t _Count,
470 : const _Elem& _Ch)
471 0 : { // look for _Ch in [_First, _First + _Count)
472 : // _DEBUG_POINTER(_First);
473 0 : return ((const _Elem *)::memchr(_First, _Ch, _Count));
474 0 : }
475 :
476 : _SCL_INSECURE_DEPRECATE
477 : static _Elem *__CLRCALL_OR_CDECL move(_Out_cap_(_Count) _Elem *_First1, _In_count_(_Count) const _Elem *_First2,
478 : size_t _Count)
479 : { // move [_First1, _First1 + _Count) to [_First2, ...)
480 : // assume there is enough space in the destination buffer
481 : return _Move_s(_First1, _Count, _First2, _Count);
482 : }
483 :
484 : static _Elem *__CLRCALL_OR_CDECL _Move_s(_Out_cap_(_Size_in_bytes) _Elem *_First1, size_t _Size_in_bytes, _In_count_(_Count) const _Elem *_First2,
485 : size_t _Count)
486 1 : { // move [_First1, _First1 + _Count) to [_First2, ...)
487 : // _DEBUG_POINTER(_First1);
488 : // _DEBUG_POINTER(_First2);
489 1 : _CRT_SECURE_MEMMOVE(_First1, _Size_in_bytes, _First2, _Count);
490 1 : return _First1;
491 1 : }
492 :
493 : static _Elem *__CLRCALL_OR_CDECL assign(_Out_cap_(_Count) _Elem *_First, size_t _Count, _Elem _Ch)
494 0 : { // assign _Count * _Ch to [_First, ...)
495 : // _DEBUG_POINTER(_First);
496 0 : return ((_Elem *)::memset(_First, _Ch, _Count));
497 0 : }
498 :
499 : static _Elem __CLRCALL_OR_CDECL to_char_type(const int_type& _Meta)
500 10 : { // convert metacharacter to character
501 10 : return ((_Elem)_Meta);
502 10 : }
503 :
504 : static int_type __CLRCALL_OR_CDECL to_int_type(const _Elem& _Ch)
505 10 : { // convert character to metacharacter
506 10 : return ((unsigned char)_Ch);
507 10 : }
508 :
509 : static bool __CLRCALL_OR_CDECL eq_int_type(const int_type& _Left,
510 : const int_type& _Right)
511 10 : { // test for metacharacter equality
512 10 : return (_Left == _Right);
513 10 : }
514 :
515 : static int_type __CLRCALL_OR_CDECL eof()
516 10 : { // return end-of-file metacharacter
517 10 : return (EOF);
518 10 : }
519 :
520 : static int_type __CLRCALL_OR_CDECL not_eof(const int_type& _Meta)
521 0 : { // return anything but EOF
522 0 : return (_Meta != eof() ? _Meta : !eof());
523 0 : }
524 : };
525 :
526 : // TEMPLATE FUNCTION _Char_traits_cat
527 : template <class _Traits>
528 : class _Inherits_from_char_traits_base
529 : {
530 : typedef char _True;
531 : class _False { char _Dummy[2]; };
532 : static _True _Inherits(_Char_traits_base);
533 : static _False _Inherits(...);
534 : static _Traits _Make_traits();
535 :
536 : public:
537 : enum { _Exists = sizeof(_Inherits(_Make_traits())) == sizeof(_True) };
538 : };
539 :
540 : template <class _Traits, bool _Inherits_from_char_traits_base>
541 : class _Char_traits_category_helper
542 : {
543 : public:
544 : typedef _Unsecure_char_traits_tag _Secure_char_traits;
545 : };
546 :
547 : // The char_traits class is secure by definition, because we added the _Copy_s and the _Move_s
548 : // methods.
549 : template <class _Elem>
550 : class _Char_traits_category_helper< char_traits<_Elem> , true>
551 : {
552 : public:
553 : typedef _Secure_char_traits_tag _Secure_char_traits;
554 : };
555 :
556 : template <class _Traits>
557 : class _Char_traits_category_helper<_Traits, true>
558 : {
559 : public:
560 : typedef typename _Traits::_Secure_char_traits _Secure_char_traits;
561 : };
562 :
563 : template <class _Traits>
564 : class _Char_traits_category
565 : {
566 : public:
567 : typedef typename _Char_traits_category_helper<_Traits, _Inherits_from_char_traits_base<_Traits>::_Exists>::_Secure_char_traits _Secure_char_traits;
568 : };
569 :
570 : // Retrieve the _Secure_char_traits tag from a user defined char_traits
571 : // methods.
572 : template<class _Traits>
573 : inline
574 : typename _Char_traits_category<_Traits>::_Secure_char_traits _Char_traits_cat()
575 13 : {
576 : typename _Char_traits_category<_Traits>::_Secure_char_traits _Secure;
577 13 : return (_Secure);
578 13 : }
579 :
580 : namespace _Traits_helper
581 : {
582 :
583 : // TEMPLATE FUNCTION _Traits_helper::copy_s
584 : template<class _Traits>
585 : inline
586 : typename _Traits::char_type *copy_s(_Out_cap_(_Size) typename _Traits::char_type *_First1, size_t _Size,
587 : _In_count_(_Count) const typename _Traits::char_type *_First2, size_t _Count)
588 13 : {
589 13 : return copy_s<_Traits>(_First1, _Size, _First2, _Count, _Char_traits_cat<_Traits>());
590 13 : }
591 :
592 : template<class _Traits>
593 : inline
594 : typename _Traits::char_type *copy_s(_Out_cap_(_Size) typename _Traits::char_type *_First1, size_t _Size,
595 : _In_count_(_Count) const typename _Traits::char_type *_First2, size_t _Count, _Secure_char_traits_tag)
596 13 : {
597 13 : return _Traits::_Copy_s(_First1, _Size, _First2, _Count);
598 13 : }
599 :
600 : // If _SECURE_SCL is turned on, the user will get a deprecation warning when calling an unsecure _Traits::copy
601 : template<class _Traits>
602 : inline
603 : _SCL_INSECURE_DEPRECATE
604 : typename _Traits::char_type *copy_s(_Out_cap_(_Size) typename _Traits::char_type *_First1, size_t _Size,
605 : _In_count_(_Count) const typename _Traits::char_type *_First2, size_t _Count, _Unsecure_char_traits_tag)
606 : {
607 : return _Traits::copy(_First1, _First2, _Count);
608 : }
609 :
610 : // TEMPLATE FUNCTION _Traits_helper::move_s
611 : template<class _Traits>
612 : inline
613 : typename _Traits::char_type *move_s(_Out_cap_(_Size) typename _Traits::char_type *_First1, size_t _Size,
614 : _In_count_(_Count) const typename _Traits::char_type *_First2, size_t _Count)
615 1 : {
616 1 : return move_s<_Traits>(_First1, _Size, _First2, _Count, _Char_traits_cat<_Traits>());
617 1 : }
618 :
619 : template<class _Traits>
620 : inline
621 : typename _Traits::char_type *move_s(_Out_cap_(_Size) typename _Traits::char_type *_First1, size_t _Size,
622 : _In_count_(_Count) const typename _Traits::char_type *_First2, size_t _Count, _Secure_char_traits_tag)
623 1 : {
624 1 : return _Traits::_Move_s(_First1, _Size, _First2, _Count);
625 1 : }
626 :
627 : // If _SECURE_SCL is turned on, the user will get a deprecation warning when calling an unsecure _Traits::copy
628 : template<class _Traits>
629 : inline
630 : _SCL_INSECURE_DEPRECATE
631 : typename _Traits::char_type *move_s(_Out_cap_(_Size) typename _Traits::char_type *_First1, size_t _Size,
632 : _In_count_(_Count) const typename _Traits::char_type *_First2, size_t _Count, _Unsecure_char_traits_tag)
633 : {
634 : return _Traits::move(_First1, _First2, _Count);
635 : }
636 :
637 : } // namespace _Traits_helper
638 :
639 : // FORWARD REFERENCES
640 : template<class _Ty>
641 : class allocator;
642 : class ios_base;
643 : template<class _Elem,
644 : class _Traits = char_traits<_Elem> >
645 : class basic_ios;
646 : template<class _Elem,
647 : class _Traits = char_traits<_Elem> >
648 : class istreambuf_iterator;
649 : template<class _Elem,
650 : class _Traits = char_traits<_Elem> >
651 : class ostreambuf_iterator;
652 : template<class _Elem,
653 : class _Traits = char_traits<_Elem> >
654 : class basic_streambuf;
655 : template<class _Elem,
656 : class _Traits = char_traits<_Elem> >
657 : class basic_istream;
658 : template<class _Elem,
659 : class _Traits = char_traits<_Elem> >
660 : class basic_ostream;
661 : template<class _Elem,
662 : class _Traits = char_traits<_Elem> >
663 : class basic_iostream;
664 : template<class _Elem,
665 : class _Traits = char_traits<_Elem>,
666 : class _Alloc = allocator<_Elem> >
667 : class basic_stringbuf;
668 : template<class _Elem,
669 : class _Traits = char_traits<_Elem>,
670 : class _Alloc = allocator<_Elem> >
671 : class basic_istringstream;
672 : template<class _Elem,
673 : class _Traits = char_traits<_Elem>,
674 : class _Alloc = allocator<_Elem> >
675 : class basic_ostringstream;
676 : template<class _Elem,
677 : class _Traits = char_traits<_Elem>,
678 : class _Alloc = allocator<_Elem> >
679 : class basic_stringstream;
680 : template<class _Elem,
681 : class _Traits = char_traits<_Elem> >
682 : class basic_filebuf;
683 : template<class _Elem,
684 : class _Traits = char_traits<_Elem> >
685 : class basic_ifstream;
686 : template<class _Elem,
687 : class _Traits = char_traits<_Elem> >
688 : class basic_ofstream;
689 : template<class _Elem,
690 : class _Traits = char_traits<_Elem> >
691 : class basic_fstream;
692 :
693 : #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE)
694 : template<class _Elem,
695 : class _InIt >
696 : class num_get;
697 : template<class _Elem,
698 : class _OutIt >
699 : class num_put;
700 : template<class _Elem>
701 : class collate;
702 : #endif /* _DLL_CPPLIB */
703 :
704 : // char TYPEDEFS
705 : typedef basic_ios<char, char_traits<char> > ios;
706 : typedef basic_streambuf<char, char_traits<char> > streambuf;
707 : typedef basic_istream<char, char_traits<char> > istream;
708 : typedef basic_ostream<char, char_traits<char> > ostream;
709 : typedef basic_iostream<char, char_traits<char> > iostream;
710 : typedef basic_stringbuf<char, char_traits<char>,
711 : allocator<char> > stringbuf;
712 : typedef basic_istringstream<char, char_traits<char>,
713 : allocator<char> > istringstream;
714 : typedef basic_ostringstream<char, char_traits<char>,
715 : allocator<char> > ostringstream;
716 : typedef basic_stringstream<char, char_traits<char>,
717 : allocator<char> > stringstream;
718 : typedef basic_filebuf<char, char_traits<char> > filebuf;
719 : typedef basic_ifstream<char, char_traits<char> > ifstream;
720 : typedef basic_ofstream<char, char_traits<char> > ofstream;
721 : typedef basic_fstream<char, char_traits<char> > fstream;
722 :
723 : // wchat_t TYPEDEFS
724 : typedef basic_ios<wchar_t, char_traits<wchar_t> > wios;
725 : typedef basic_streambuf<wchar_t, char_traits<wchar_t> >
726 : wstreambuf;
727 : typedef basic_istream<wchar_t, char_traits<wchar_t> > wistream;
728 : typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
729 : typedef basic_iostream<wchar_t, char_traits<wchar_t> > wiostream;
730 : typedef basic_stringbuf<wchar_t, char_traits<wchar_t>,
731 : allocator<wchar_t> > wstringbuf;
732 : typedef basic_istringstream<wchar_t, char_traits<wchar_t>,
733 : allocator<wchar_t> > wistringstream;
734 : typedef basic_ostringstream<wchar_t, char_traits<wchar_t>,
735 : allocator<wchar_t> > wostringstream;
736 : typedef basic_stringstream<wchar_t, char_traits<wchar_t>,
737 : allocator<wchar_t> > wstringstream;
738 : typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
739 : typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
740 : typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
741 : typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
742 :
743 :
744 :
745 : #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE)
746 : typedef num_get<char, istreambuf_iterator<char, char_traits<char> > >
747 : numget;
748 : typedef num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >
749 : wnumget;
750 : typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > >
751 : numput;
752 : typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >
753 : wnumput;
754 : typedef collate<char> ncollate;
755 : typedef collate<wchar_t> wcollate;
756 : #endif /* _DLL_CPPLIB */
757 :
758 : _STD_END
759 :
760 : #ifdef _MSC_VER
761 : #pragma warning(pop)
762 : #pragma pack(pop)
763 : #endif /* _MSC_VER */
764 :
765 : #endif /* RC_INVOKED */
766 : #endif /* _IOSFWD_ */
767 :
768 : /*
769 : * Copyright (c) 1992-2008 by P.J. Plauger. ALL RIGHTS RESERVED.
770 : * Consult your license regarding permissions and restrictions.
771 : V5.05:0009 */
772 :
773 :
|