Go to the documentation of this file.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
00031
00032
00033
00034
00035 #ifndef _STREAMBUF_TCC
00036 #define _STREAMBUF_TCC 1
00037
00038 #pragma GCC system_header
00039
00040 namespace std _GLIBCXX_VISIBILITY(default)
00041 {
00042 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00043
00044 template<typename _CharT, typename _Traits>
00045 streamsize
00046 basic_streambuf<_CharT, _Traits>::
00047 xsgetn(char_type* __s, streamsize __n)
00048 {
00049 streamsize __ret = 0;
00050 while (__ret < __n)
00051 {
00052 const streamsize __buf_len = this->egptr() - this->gptr();
00053 if (__buf_len)
00054 {
00055 const streamsize __remaining = __n - __ret;
00056 const streamsize __len = std::min(__buf_len, __remaining);
00057 traits_type::copy(__s, this->gptr(), __len);
00058 __ret += __len;
00059 __s += __len;
00060 this->__safe_gbump(__len);
00061 }
00062
00063 if (__ret < __n)
00064 {
00065 const int_type __c = this->uflow();
00066 if (!traits_type::eq_int_type(__c, traits_type::eof()))
00067 {
00068 traits_type::assign(*__s++, traits_type::to_char_type(__c));
00069 ++__ret;
00070 }
00071 else
00072 break;
00073 }
00074 }
00075 return __ret;
00076 }
00077
00078 template<typename _CharT, typename _Traits>
00079 streamsize
00080 basic_streambuf<_CharT, _Traits>::
00081 xsputn(const char_type* __s, streamsize __n)
00082 {
00083 streamsize __ret = 0;
00084 while (__ret < __n)
00085 {
00086 const streamsize __buf_len = this->epptr() - this->pptr();
00087 if (__buf_len)
00088 {
00089 const streamsize __remaining = __n - __ret;
00090 const streamsize __len = std::min(__buf_len, __remaining);
00091 traits_type::copy(this->pptr(), __s, __len);
00092 __ret += __len;
00093 __s += __len;
00094 this->__safe_pbump(__len);
00095 }
00096
00097 if (__ret < __n)
00098 {
00099 int_type __c = this->overflow(traits_type::to_int_type(*__s));
00100 if (!traits_type::eq_int_type(__c, traits_type::eof()))
00101 {
00102 ++__ret;
00103 ++__s;
00104 }
00105 else
00106 break;
00107 }
00108 }
00109 return __ret;
00110 }
00111
00112
00113
00114
00115 template<typename _CharT, typename _Traits>
00116 streamsize
00117 __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>* __sbin,
00118 basic_streambuf<_CharT, _Traits>* __sbout,
00119 bool& __ineof)
00120 {
00121 streamsize __ret = 0;
00122 __ineof = true;
00123 typename _Traits::int_type __c = __sbin->sgetc();
00124 while (!_Traits::eq_int_type(__c, _Traits::eof()))
00125 {
00126 __c = __sbout->sputc(_Traits::to_char_type(__c));
00127 if (_Traits::eq_int_type(__c, _Traits::eof()))
00128 {
00129 __ineof = false;
00130 break;
00131 }
00132 ++__ret;
00133 __c = __sbin->snextc();
00134 }
00135 return __ret;
00136 }
00137
00138 template<typename _CharT, typename _Traits>
00139 inline streamsize
00140 __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin,
00141 basic_streambuf<_CharT, _Traits>* __sbout)
00142 {
00143 bool __ineof;
00144 return __copy_streambufs_eof(__sbin, __sbout, __ineof);
00145 }
00146
00147
00148
00149
00150 #if _GLIBCXX_EXTERN_TEMPLATE
00151 extern template class basic_streambuf<char>;
00152 extern template
00153 streamsize
00154 __copy_streambufs(basic_streambuf<char>*,
00155 basic_streambuf<char>*);
00156 extern template
00157 streamsize
00158 __copy_streambufs_eof(basic_streambuf<char>*,
00159 basic_streambuf<char>*, bool&);
00160
00161 #ifdef _GLIBCXX_USE_WCHAR_T
00162 extern template class basic_streambuf<wchar_t>;
00163 extern template
00164 streamsize
00165 __copy_streambufs(basic_streambuf<wchar_t>*,
00166 basic_streambuf<wchar_t>*);
00167 extern template
00168 streamsize
00169 __copy_streambufs_eof(basic_streambuf<wchar_t>*,
00170 basic_streambuf<wchar_t>*, bool&);
00171 #endif
00172 #endif
00173
00174 _GLIBCXX_END_NAMESPACE_VERSION
00175 }
00176
00177 #endif