3 * Silicon Graphics Computer Systems, Inc.
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
11 * Permission to use or copy this software for any purpose is hereby granted
12 * without fee, provided the above notices are retained on all copies.
13 * Permission to modify the code and to distribute modified code is granted,
14 * provided the above notices are retained, and a notice that the code was
15 * modified is included with the above copyright notice.
18 #include "stlport_prefix.h"
20 #ifndef _STLP_NO_MBSTATE_T
27 //----------------------------------------------------------------------
28 // codecvt<char, char, mbstate_t>
30 codecvt<char, char, mbstate_t>::~codecvt() {}
32 int codecvt<char, char, mbstate_t>::do_length(const mbstate_t&,
36 { return (int)(min) ( __STATIC_CAST(size_t, (end - from)), mx); }
38 int codecvt<char, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
42 codecvt<char, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
46 codecvt<char, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
50 codecvt<char, char, mbstate_t>::do_unshift(mbstate_t& /* __state */,
52 char* /* __to_limit */,
53 char*& __to_next) const
54 { __to_next = __to; return noconv; }
57 codecvt<char, char, mbstate_t>::do_in (mbstate_t& /* __state */ ,
59 const char* /* __from_end */,
60 const char*& __from_next,
63 char*& __to_next) const
64 { __from_next = __from; __to_next = __to; return noconv; }
67 codecvt<char, char, mbstate_t>::do_out(mbstate_t& /* __state */,
69 const char* /* __from_end */,
70 const char*& __from_next,
72 char* /* __to_limit */,
73 char*& __to_next) const
74 { __from_next = __from; __to_next = __to; return noconv; }
77 #if !defined (_STLP_NO_WCHAR_T)
78 //----------------------------------------------------------------------
79 // codecvt<wchar_t, char, mbstate_t>
81 codecvt<wchar_t, char, mbstate_t>::~codecvt() {}
84 codecvt<wchar_t, char, mbstate_t>::result
85 codecvt<wchar_t, char, mbstate_t>::do_out(state_type& /* state */,
86 const intern_type* from,
87 const intern_type* from_end,
88 const intern_type*& from_next,
90 extern_type* to_limit,
91 extern_type*& to_next) const {
92 ptrdiff_t len = (min) (from_end - from, to_limit - to);
93 copy(from, from + len, to);
94 from_next = from + len;
99 codecvt<wchar_t, char, mbstate_t>::result
100 codecvt<wchar_t, char, mbstate_t>::do_in (state_type& /* state */,
101 const extern_type* from,
102 const extern_type* from_end,
103 const extern_type*& from_next,
105 intern_type* to_limit,
106 intern_type*& to_next) const {
107 ptrdiff_t len = (min) (from_end - from, to_limit - to);
108 copy(__REINTERPRET_CAST(const unsigned char*, from),
109 __REINTERPRET_CAST(const unsigned char*, from) + len, to);
110 from_next = from + len;
115 codecvt<wchar_t, char, mbstate_t>::result
116 codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& /* state */,
119 extern_type*& to_next) const {
124 int codecvt<wchar_t, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
127 bool codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
130 int codecvt<wchar_t, char, mbstate_t>::do_length(const state_type&,
131 const extern_type* from,
132 const extern_type* end,
134 { return (int)(min) ((size_t) (end - from), mx); }
136 int codecvt<wchar_t, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
142 #endif /* _STLP_NO_MBSTATE_T */