32#ifndef _RWSTD_RW_TRAITS_H_INCLUDED
33#define _RWSTD_RW_TRAITS_H_INCLUDED
35#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
39#ifndef _RWSTD_RW_MBSTATE_H_INCLUDED
44#if defined (_RWSTDDEBUG) || defined (_RWSTD_EDG_ECCP)
52_RWSTD_EXPORT void* __rw_memcpy (
void*,
const void*, _RWSTD_SIZE_T);
53_RWSTD_EXPORT void* __rw_memmove (
void*,
const void*, _RWSTD_SIZE_T);
54_RWSTD_EXPORT const void* __rw_memchr (
const void*,
int, _RWSTD_SIZE_T);
56_RWSTD_EXPORT int __rw_memcmp (
const void*,
const void*, _RWSTD_SIZE_T);
59# ifndef _RWSTD_NO_WCHAR_T
61_RWSTD_EXPORT wchar_t* __rw_wmemcpy (
wchar_t*,
const wchar_t*, _RWSTD_SIZE_T);
62_RWSTD_EXPORT wchar_t* __rw_wmemmove (
wchar_t*,
const wchar_t*, _RWSTD_SIZE_T);
64__rw_wmemchr (
const wchar_t*,
wchar_t, _RWSTD_SIZE_T);
65_RWSTD_EXPORT wchar_t* __rw_wmemset (
wchar_t*,
wchar_t, _RWSTD_SIZE_T);
66_RWSTD_EXPORT int __rw_wmemcmp (
const wchar_t*,
const wchar_t*, _RWSTD_SIZE_T);
73# define _RWSTD_MEMCPY _RW::__rw_memcpy
74# define _RWSTD_MEMCMP _RW::__rw_memcmp
75# define _RWSTD_MEMCHR _RW::__rw_memchr
76# define _RWSTD_MEMMOVE _RW::__rw_memmove
77# define _RWSTD_MEMSET _RW::__rw_memset
78# define _RWSTD_STRLEN _RW::__rw_strlen
80# define _RWSTD_WMEMCPY _RW::__rw_wmemcpy
81# define _RWSTD_WMEMCMP _RW::__rw_wmemcmp
82# define _RWSTD_WMEMCHR _RW::__rw_wmemchr
83# define _RWSTD_WMEMMOVE _RW::__rw_wmemmove
84# define _RWSTD_WMEMSET _RW::__rw_wmemset
85# define _RWSTD_WCSLEN _RW::__rw_wcslen
88# if 4 <= __GNUG__ && !defined (__INTEL_COMPILER)
90# define _RWSTD_MEMCPY __builtin_memcpy
91# define _RWSTD_MEMCMP __builtin_memcmp
92# define _RWSTD_MEMMOVE __builtin_memmove
93# define _RWSTD_MEMSET __builtin_memset
94# define _RWSTD_STRLEN __builtin_strlen
96# if 4 < __GNUG__ || 3 <= __GNUC_MINOR__
98# define _RWSTD_MEMCHR __builtin_memchr
100# include _RWSTD_CSTRING
101# define _RWSTD_MEMCHR _RWSTD_C::memchr
104# include _RWSTD_CSTRING
106# define _RWSTD_MEMCPY _RWSTD_C::memcpy
107# define _RWSTD_MEMCMP _RWSTD_C::memcmp
108# define _RWSTD_MEMMOVE _RWSTD_C::memmove
109# define _RWSTD_MEMSET _RWSTD_C::memset
110# define _RWSTD_STRLEN _RWSTD_C::strlen
111# define _RWSTD_MEMCHR _RWSTD_C::memchr
114# include _RWSTD_CWCHAR
116# ifndef _RWSTD_NO_WMEMCPY
117# define _RWSTD_WMEMCPY _RWSTD_C::wmemcpy
118# elif !defined (_RWSTD_NO_WCHAR_T)
123__rw_wmemcpy (
wchar_t*,
const wchar_t*, _RWSTD_SIZE_T);
128# define _RWSTD_WMEMCPY _RW::__rw_wmemcpy
131# ifndef _RWSTD_NO_WMEMCMP
132# define _RWSTD_WMEMCMP wmemcmp
133# elif !defined (_RWSTD_NO_WCHAR_T)
138__rw_wmemcmp (
const wchar_t*,
const wchar_t*, _RWSTD_SIZE_T);
143# define _RWSTD_WMEMCMP _RW::__rw_wmemcmp
146# ifndef _RWSTD_NO_WMEMMOVE
147# define _RWSTD_WMEMMOVE _RWSTD_C::wmemmove
148# elif !defined (_RWSTD_NO_WCHAR_T)
153__rw_wmemmove (
wchar_t*,
const wchar_t*, _RWSTD_SIZE_T);
158# define _RWSTD_WMEMMOVE _RW::__rw_wmemmove
161# ifndef _RWSTD_NO_WMEMSET
162# define _RWSTD_WMEMSET _RWSTD_C::wmemset
163# elif !defined (_RWSTD_NO_WCHAR_T)
168__rw_wmemset (
wchar_t*,
wchar_t, _RWSTD_SIZE_T);
173# define _RWSTD_WMEMSET _RW::__rw_wmemset
176# ifndef _RWSTD_NO_WCSLEN
177# define _RWSTD_WCSLEN _RWSTD_C::wcslen
178# elif !defined (_RWSTD_NO_WCHAR_T)
183__rw_wcslen (
const wchar_t*);
188# define _RWSTD_WCSLEN _RW::__rw_wcslen
191# ifndef _RWSTD_NO_WMEMCHR
192# define _RWSTD_WMEMCHR _RWSTD_C::wmemchr
193# elif !defined (_RWSTD_NO_WCHAR_T)
198__rw_wmemchr (
const wchar_t*,
wchar_t, _RWSTD_SIZE_T);
203# define _RWSTD_WMEMCHR _RW::__rw_wmemchr
216typedef _RWSTD_PTRDIFF_T streamsize;
220template <
class _StateT>
225 typedef _StateT state_type;
227#ifndef _RWSTD_NO_POD_ZERO_INIT
230 const state_type &__state = state_type ())
254 void state (state_type __state) {
259 state_type state ()
const {
265 return _C_pos -= __off, *
this;
269 return _C_pos += __off, *
this;
273 return fpos (*
this) -= __off;
277 return fpos (*
this) += __off;
290template <
class _CharT>
294#ifndef _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY
296template <
class _CharT>
299 typedef _CharT char_type;
300 typedef int int_type;
303 typedef fpos<state_type> pos_type;
305 static int_type eof () {
309 static void assign (char_type& __c1,
const char_type& __c2) {
313 static bool eq (
const char_type& __c1,
const char_type& __c2) {
317 static bool lt (
const char_type& __c1,
const char_type& __c2) {
322 compare (
const char_type* __s1,
const char_type* __s2, _RWSTD_SIZE_T __n) {
323 for (_RWSTD_SIZE_T __i = 0; __i != __n; ++__i) {
324 if (!eq (__s1[__i], __s2[__i])) {
325 return lt (__s1[__i], __s2[__i]) ? -1 : 1;
331 static _RWSTD_SIZE_T length (
const char_type *__s) {
332 _RWSTD_SIZE_T __len = 0;
333 while (!eq (*__s++, char_type ()))
338 static const char_type*
339 find (
const char_type* __s, _RWSTD_SIZE_T __n,
const char_type& __c) {
340 while (__n-- > 0 && !eq (*__s, __c) )
342 return eq (*__s, __c) ? __s : 0;
346 move (char_type* __s1,
const char_type* __s2, _RWSTD_SIZE_T __n) {
352 copy (char_type *__dst,
const char_type *__src, _RWSTD_SIZE_T __n) {
355 __n *
sizeof (char_type));
360 assign (char_type* __s, _RWSTD_SIZE_T __n, char_type __c) {
361 char_type* __tmp = __s;
367 static bool eq_int_type (
const int_type& __c1,
const int_type& __c2) {
371 static int_type not_eof (
const int_type& __c) {
372 return eq_int_type (eof (), __c) ? 0 : __c;
375 static char_type to_char_type (
const int_type& __c) {
380 static int_type to_int_type (
const char_type& __c) {
391struct char_traits<char>
393 typedef char char_type;
397 typedef fpos<state_type> pos_type;
399 static int_type eof () {
400 return int_type (_RWSTD_EOF);
403 static void assign (char_type& __c1,
const char_type& __c2){
407 static bool eq (
const char_type& __c1,
const char_type& __c2) {
411 static bool lt (
const char_type& __c1,
const char_type& __c2) {
419 compare (
const char_type* __s1,
const char_type* __s2, _RWSTD_SIZE_T __n) {
423 static const char_type*
424 find (
const char_type* __s, _RWSTD_SIZE_T __n,
const char_type& __c) {
433 static _RWSTD_SIZE_T length (
const char_type *__s) {
438 move (char_type* __s1,
const char_type* __s2, _RWSTD_SIZE_T __n) {
444 copy (char_type *__dst,
const char_type *__src, _RWSTD_SIZE_T __n) {
450 assign (char_type* __s, _RWSTD_SIZE_T __n, char_type __c) {
455 static bool eq_int_type (
const int_type& __c1,
const int_type& __c2) {
459 static int_type not_eof (
const int_type& __c) {
460 return eq_int_type (eof (), __c) ? 0 : __c;
463 static char_type to_char_type (
const int_type& __c) {
467 static int_type to_int_type (
const char_type& __c) {
474#ifndef _RWSTD_NO_WCHAR_T
480 typedef wchar_t char_type;
484 typedef fpos<state_type> pos_type;
486 static int_type eof () {
487 return int_type (_RWSTD_WEOF);
490 static void assign (char_type& __c1,
const char_type& __c2) {
494 static bool eq (
const char_type& __c1,
const char_type& __c2) {
498 static bool lt (
const char_type& __c1,
const char_type& __c2) {
503 compare (
const char_type* __s1,
const char_type* __s2, _RWSTD_SIZE_T __n) {
507 static _RWSTD_SIZE_T length (
const char_type *__s) {
512 static const char_type*
513 find (
const char_type* __s, _RWSTD_SIZE_T __n,
const char_type& __c) {
521 copy (char_type *__dst,
const char_type *__src, _RWSTD_SIZE_T __n) {
527 move (char_type* __s1,
const char_type* __s2, _RWSTD_SIZE_T __n) {
533 assign (char_type* __s, _RWSTD_SIZE_T __n, char_type __c) {
538 static bool eq_int_type (
const int_type& __c1,
const int_type& __c2) {
542 static int_type not_eof (
const int_type& __c) {
543 return eq_int_type (eof (), __c) ? 0 : __c;
546 static char_type to_char_type (
const int_type& __c) {
550 static int_type to_int_type (
const char_type& __c) {
const minus< T > & operator-(const minus< T > &lhs, const minus< T > &rhs)
#define _RWSTD_SPECIALIZED_CLASS
void operator+(typename A< T >::I, const A< T > &)
#define _RWSTD_STATIC_CAST(T, x)
#define _RWSTD_NAMESPACE(name)
#define _RWSTD_CONST_CAST(T, x)