00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <locale>
00031
00032 namespace std
00033 {
00034
00035 locale::id codecvt<char, char, mbstate_t>::id;
00036
00037 #ifdef _GLIBCPP_USE_WCHAR_T
00038 locale::id codecvt<wchar_t, char, mbstate_t>::id;
00039 #endif
00040
00041 #ifdef _GLIBCPP_USE___ENC_TRAITS
00042
00043 const int __enc_traits::_S_max_size;
00044 #endif
00045
00046 codecvt<char, char, mbstate_t>::
00047 codecvt(size_t __refs)
00048 : __codecvt_abstract_base<char, char, mbstate_t>(__refs)
00049 { _M_c_locale_codecvt = _S_c_locale; }
00050
00051 codecvt<char, char, mbstate_t>::
00052 codecvt(__c_locale __cloc, size_t __refs)
00053 : __codecvt_abstract_base<char, char, mbstate_t>(__refs)
00054 { _M_c_locale_codecvt = _S_clone_c_locale(__cloc); }
00055
00056 codecvt<char, char, mbstate_t>::
00057 ~codecvt()
00058 { _S_destroy_c_locale(_M_c_locale_codecvt); }
00059
00060 codecvt_base::result
00061 codecvt<char, char, mbstate_t>::
00062 do_out(state_type&, const intern_type* __from,
00063 const intern_type* __from_end, const intern_type*& __from_next,
00064 extern_type* __to, extern_type* __to_end,
00065 extern_type*& __to_next) const
00066 {
00067 size_t __len = min(__from_end - __from, __to_end - __to);
00068 memcpy(__to, __from, __len);
00069 __from_next = __from;
00070 __to_next = __to;
00071 return noconv;
00072 }
00073
00074 codecvt_base::result
00075 codecvt<char, char, mbstate_t>::
00076 do_unshift(state_type&, extern_type* __to,
00077 extern_type*, extern_type*& __to_next) const
00078 {
00079 __to_next = __to;
00080 return noconv;
00081 }
00082
00083 codecvt_base::result
00084 codecvt<char, char, mbstate_t>::
00085 do_in(state_type&, const extern_type* __from,
00086 const extern_type* __from_end, const extern_type*& __from_next,
00087 intern_type* __to, intern_type* __to_end,
00088 intern_type*& __to_next) const
00089 {
00090 size_t __len = min(__from_end - __from, __to_end - __to);
00091 memcpy(__to, __from, __len);
00092 __from_next = __from;
00093 __to_next = __to;
00094 return noconv;
00095 }
00096
00097 int
00098 codecvt<char, char, mbstate_t>::
00099 do_encoding() const throw()
00100 { return 1; }
00101
00102 bool
00103 codecvt<char, char, mbstate_t>::
00104 do_always_noconv() const throw()
00105 { return true; }
00106
00107 int
00108 codecvt<char, char, mbstate_t>::
00109 do_length (const state_type&, const extern_type* __from,
00110 const extern_type* __end, size_t __max) const
00111 { return min(__max, static_cast<size_t>(__end - __from)); }
00112
00113 int
00114 codecvt<char, char, mbstate_t>::
00115 do_max_length() const throw()
00116 { return 1; }
00117
00118 #ifdef _GLIBCPP_USE_WCHAR_T
00119
00120 codecvt<wchar_t, char, mbstate_t>::
00121 codecvt(size_t __refs)
00122 : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs)
00123 { _M_c_locale_codecvt = _S_c_locale; }
00124
00125 codecvt<wchar_t, char, mbstate_t>::
00126 codecvt(__c_locale __cloc, size_t __refs)
00127 : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs)
00128 { _M_c_locale_codecvt = _S_clone_c_locale(__cloc); }
00129
00130 codecvt<wchar_t, char, mbstate_t>::
00131 ~codecvt()
00132 { _S_destroy_c_locale(_M_c_locale_codecvt); }
00133
00134 codecvt_base::result
00135 codecvt<wchar_t, char, mbstate_t>::
00136 do_unshift(state_type&, extern_type* __to,
00137 extern_type*, extern_type*& __to_next) const
00138 {
00139 __to_next = __to;
00140 return noconv;
00141 }
00142
00143 int
00144 codecvt<wchar_t, char, mbstate_t>::
00145 do_encoding() const throw()
00146 { return sizeof(wchar_t); }
00147
00148 bool
00149 codecvt<wchar_t, char, mbstate_t>::
00150 do_always_noconv() const throw()
00151 { return false; }
00152
00153 int
00154 codecvt<wchar_t, char, mbstate_t>::
00155 do_length(const state_type&, const extern_type* __from,
00156 const extern_type* __end, size_t __max) const
00157 { return min(__max, static_cast<size_t>(__end - __from)); }
00158
00159 int
00160 codecvt<wchar_t, char, mbstate_t>::
00161 do_max_length() const throw()
00162 { return 1; }
00163 #endif // _GLIBCPP_USE_WCHAR_T
00164 }