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
00036 #ifndef _BASIC_IOS_TCC
00037 #define _BASIC_IOS_TCC 1
00038
00039 #pragma GCC system_header
00040
00041 _GLIBCXX_BEGIN_NAMESPACE(std)
00042
00043 template<typename _CharT, typename _Traits>
00044 void
00045 basic_ios<_CharT, _Traits>::clear(iostate __state)
00046 {
00047 if (this->rdbuf())
00048 _M_streambuf_state = __state;
00049 else
00050 _M_streambuf_state = __state | badbit;
00051 if (this->exceptions() & this->rdstate())
00052 __throw_ios_failure(__N("basic_ios::clear"));
00053 }
00054
00055 template<typename _CharT, typename _Traits>
00056 basic_streambuf<_CharT, _Traits>*
00057 basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
00058 {
00059 basic_streambuf<_CharT, _Traits>* __old = _M_streambuf;
00060 _M_streambuf = __sb;
00061 this->clear();
00062 return __old;
00063 }
00064
00065 template<typename _CharT, typename _Traits>
00066 basic_ios<_CharT, _Traits>&
00067 basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
00068 {
00069
00070
00071 if (this != &__rhs)
00072 {
00073
00074
00075
00076
00077 _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ?
00078 _M_local_word : new _Words[__rhs._M_word_size];
00079
00080
00081 _Callback_list* __cb = __rhs._M_callbacks;
00082 if (__cb)
00083 __cb->_M_add_reference();
00084 _M_call_callbacks(erase_event);
00085 if (_M_word != _M_local_word)
00086 {
00087 delete [] _M_word;
00088 _M_word = 0;
00089 }
00090 _M_dispose_callbacks();
00091
00092
00093 _M_callbacks = __cb;
00094 for (int __i = 0; __i < __rhs._M_word_size; ++__i)
00095 __words[__i] = __rhs._M_word[__i];
00096 _M_word = __words;
00097 _M_word_size = __rhs._M_word_size;
00098
00099 this->flags(__rhs.flags());
00100 this->width(__rhs.width());
00101 this->precision(__rhs.precision());
00102 this->tie(__rhs.tie());
00103 this->fill(__rhs.fill());
00104 _M_ios_locale = __rhs.getloc();
00105 _M_cache_locale(_M_ios_locale);
00106
00107 _M_call_callbacks(copyfmt_event);
00108
00109
00110 this->exceptions(__rhs.exceptions());
00111 }
00112 return *this;
00113 }
00114
00115 template<typename _CharT, typename _Traits>
00116 char
00117 basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
00118 { return __check_facet(_M_ctype).narrow(__c, __dfault); }
00119
00120 template<typename _CharT, typename _Traits>
00121 _CharT
00122 basic_ios<_CharT, _Traits>::widen(char __c) const
00123 { return __check_facet(_M_ctype).widen(__c); }
00124
00125
00126 template<typename _CharT, typename _Traits>
00127 locale
00128 basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
00129 {
00130 locale __old(this->getloc());
00131 ios_base::imbue(__loc);
00132 _M_cache_locale(__loc);
00133 if (this->rdbuf() != 0)
00134 this->rdbuf()->pubimbue(__loc);
00135 return __old;
00136 }
00137
00138 template<typename _CharT, typename _Traits>
00139 void
00140 basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
00141 {
00142
00143 ios_base::_M_init();
00144
00145
00146 _M_cache_locale(_M_ios_locale);
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 _M_fill = _CharT();
00161 _M_fill_init = false;
00162
00163 _M_tie = 0;
00164 _M_exception = goodbit;
00165 _M_streambuf = __sb;
00166 _M_streambuf_state = __sb ? goodbit : badbit;
00167 }
00168
00169 template<typename _CharT, typename _Traits>
00170 void
00171 basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc)
00172 {
00173 if (__builtin_expect(has_facet<__ctype_type>(__loc), true))
00174 _M_ctype = &use_facet<__ctype_type>(__loc);
00175 else
00176 _M_ctype = 0;
00177
00178 if (__builtin_expect(has_facet<__num_put_type>(__loc), true))
00179 _M_num_put = &use_facet<__num_put_type>(__loc);
00180 else
00181 _M_num_put = 0;
00182
00183 if (__builtin_expect(has_facet<__num_get_type>(__loc), true))
00184 _M_num_get = &use_facet<__num_get_type>(__loc);
00185 else
00186 _M_num_get = 0;
00187 }
00188
00189
00190
00191
00192 #if _GLIBCXX_EXTERN_TEMPLATE
00193 extern template class basic_ios<char>;
00194
00195 #ifdef _GLIBCXX_USE_WCHAR_T
00196 extern template class basic_ios<wchar_t>;
00197 #endif
00198 #endif
00199
00200 _GLIBCXX_END_NAMESPACE
00201
00202 #endif