Internal consistency checks.....
2000-07-19 Benjamin Kosnik <bkoz@milou.soma.redhat.com> Internal consistency checks..... * bits/ios_base.h: Change _M_locale_ios to _M_ios_locale. * src/ios.cc: Same. * bits/basic_ios.h: Change _M_fctype_ios to _M_ios_fctype. * bits/basic_ios.tcc: Same. * bits/std_streambuf.h: Change _M_locale_buf to _M_buf_locale. Change _M_fctype_buf to _M_buf_fctype. * bits/fstream.tcc: Same. * bits/std_streambuf.h: Change _M_buf_bump to _M_out_cur_move. Change _M_locale_set to _M_buf_locale_init. * bits/streambuf.tcc: Same. * bits/sstream.tcc: Same. * bits/fstream.tcc: Same. * bits/std_streambuf.h: Make typedefs consistent. (_M_buf_bump): Be more careful with input sequence. * bits/std_sstream.h: Same. * bits/std_fstream.h: Same. From-SVN: r35129
This commit is contained in:
parent
622c0bfebd
commit
456183bbea
11 changed files with 143 additions and 116 deletions
|
@ -1,4 +1,29 @@
|
||||||
2000-07-18 Benjamin Kosnik <bkoz@soma.redhat.com>
|
2000-07-19 Benjamin Kosnik <bkoz@milou.soma.redhat.com>
|
||||||
|
|
||||||
|
Internal consistency checks.....
|
||||||
|
* bits/ios_base.h: Change _M_locale_ios to _M_ios_locale.
|
||||||
|
* src/ios.cc: Same.
|
||||||
|
|
||||||
|
* bits/basic_ios.h: Change _M_fctype_ios to _M_ios_fctype.
|
||||||
|
* bits/basic_ios.tcc: Same.
|
||||||
|
|
||||||
|
* bits/std_streambuf.h: Change _M_locale_buf to _M_buf_locale.
|
||||||
|
Change _M_fctype_buf to _M_buf_fctype.
|
||||||
|
* bits/fstream.tcc: Same.
|
||||||
|
|
||||||
|
* bits/std_streambuf.h: Change _M_buf_bump to _M_out_cur_move.
|
||||||
|
Change _M_locale_set to _M_buf_locale_init.
|
||||||
|
* bits/streambuf.tcc: Same.
|
||||||
|
* bits/sstream.tcc: Same.
|
||||||
|
* bits/fstream.tcc: Same.
|
||||||
|
|
||||||
|
* bits/std_streambuf.h: Make typedefs consistent.
|
||||||
|
(_M_buf_bump): Be more careful with input sequence.
|
||||||
|
|
||||||
|
* bits/std_sstream.h: Same.
|
||||||
|
* bits/std_fstream.h: Same.
|
||||||
|
|
||||||
|
2000-07-18 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
|
||||||
|
|
||||||
* acinclude.m4: Tweaks.
|
* acinclude.m4: Tweaks.
|
||||||
* config/c_io_libio.cc: Tweaks.
|
* config/c_io_libio.cc: Tweaks.
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace std {
|
||||||
iostate _M_streambuf_state;
|
iostate _M_streambuf_state;
|
||||||
|
|
||||||
// Cached use_facet<ctype>, which is based on the current locale info.
|
// Cached use_facet<ctype>, which is based on the current locale info.
|
||||||
const __ctype_type* _M_fctype_ios;
|
const __ctype_type* _M_ios_fctype;
|
||||||
// From ostream.
|
// From ostream.
|
||||||
const __numput_type* _M_fnumput;
|
const __numput_type* _M_fnumput;
|
||||||
// From istream.
|
// From istream.
|
||||||
|
@ -76,7 +76,7 @@ namespace std {
|
||||||
|
|
||||||
inline const __ctype_type*
|
inline const __ctype_type*
|
||||||
_M_get_fctype_ios(void)
|
_M_get_fctype_ios(void)
|
||||||
{ return _M_fctype_ios; }
|
{ return _M_ios_fctype; }
|
||||||
|
|
||||||
inline const __numget_type*
|
inline const __numget_type*
|
||||||
_M_get_fnumget(void)
|
_M_get_fnumget(void)
|
||||||
|
|
|
@ -91,12 +91,12 @@ namespace std {
|
||||||
template<typename _CharT, typename _Traits>
|
template<typename _CharT, typename _Traits>
|
||||||
char
|
char
|
||||||
basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
|
basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
|
||||||
{ return _M_fctype_ios->narrow(__c, __dfault); }
|
{ return _M_ios_fctype->narrow(__c, __dfault); }
|
||||||
|
|
||||||
template<typename _CharT, typename _Traits>
|
template<typename _CharT, typename _Traits>
|
||||||
_CharT
|
_CharT
|
||||||
basic_ios<_CharT, _Traits>::widen(char __c) const
|
basic_ios<_CharT, _Traits>::widen(char __c) const
|
||||||
{ return _M_fctype_ios->widen(__c); }
|
{ return _M_ios_fctype->widen(__c); }
|
||||||
|
|
||||||
// Locales:
|
// Locales:
|
||||||
template<typename _CharT, typename _Traits>
|
template<typename _CharT, typename _Traits>
|
||||||
|
@ -105,7 +105,7 @@ namespace std {
|
||||||
{
|
{
|
||||||
locale __old(this->getloc());
|
locale __old(this->getloc());
|
||||||
ios_base::imbue(__loc);
|
ios_base::imbue(__loc);
|
||||||
_M_fctype_ios = &use_facet<__ctype_type>(__loc);
|
_M_ios_fctype = &use_facet<__ctype_type>(__loc);
|
||||||
_M_fnumput = &use_facet<__numput_type>(__loc);
|
_M_fnumput = &use_facet<__numput_type>(__loc);
|
||||||
_M_fnumget = &use_facet<__numget_type>(__loc);
|
_M_fnumget = &use_facet<__numget_type>(__loc);
|
||||||
if (this->rdbuf() != 0)
|
if (this->rdbuf() != 0)
|
||||||
|
@ -120,7 +120,7 @@ namespace std {
|
||||||
// NB: This may be called more than once on the same object.
|
// NB: This may be called more than once on the same object.
|
||||||
ios_base::_M_init();
|
ios_base::_M_init();
|
||||||
locale __loc = this->getloc();
|
locale __loc = this->getloc();
|
||||||
_M_fctype_ios = &use_facet<__ctype_type>(__loc);
|
_M_ios_fctype = &use_facet<__ctype_type>(__loc);
|
||||||
// Should be filled in by ostream and istream, respectively.
|
// Should be filled in by ostream and istream, respectively.
|
||||||
_M_fnumput = &use_facet<__numput_type>(__loc);
|
_M_fnumput = &use_facet<__numput_type>(__loc);
|
||||||
_M_fnumget = &use_facet<__numget_type>(__loc);
|
_M_fnumget = &use_facet<__numget_type>(__loc);
|
||||||
|
|
|
@ -329,7 +329,7 @@ namespace std
|
||||||
if (!__testpos)
|
if (!__testpos)
|
||||||
{
|
{
|
||||||
*_M_out_cur = traits_type::to_char_type(__c);
|
*_M_out_cur = traits_type::to_char_type(__c);
|
||||||
_M_buf_bump(1);
|
_M_out_cur_move(1);
|
||||||
__retval = traits_type::not_eof(__c);
|
__retval = traits_type::not_eof(__c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -535,14 +535,14 @@ namespace std
|
||||||
bool __testbeg = gptr() == eback() && pptr() == pbase();
|
bool __testbeg = gptr() == eback() && pptr() == pbase();
|
||||||
bool __teststate = _M_fcvt->encoding() == -1;
|
bool __teststate = _M_fcvt->encoding() == -1;
|
||||||
|
|
||||||
_M_locale_set = true;
|
_M_buf_locale_init = true;
|
||||||
if (__testbeg && !__teststate && _M_locale_buf != __loc)
|
if (__testbeg && !__teststate && _M_buf_locale != __loc)
|
||||||
{
|
{
|
||||||
// XXX Will need to save these older values.
|
// XXX Will need to save these older values.
|
||||||
_M_locale_buf = __loc;
|
_M_buf_locale = __loc;
|
||||||
_M_fcvt = &use_facet<__codecvt_type>(_M_locale_buf);
|
_M_fcvt = &use_facet<__codecvt_type>(_M_buf_locale);
|
||||||
// XXX Necessary?
|
// XXX Necessary?
|
||||||
_M_fctype_buf = &use_facet<__ctype_type>(_M_locale_buf);
|
_M_buf_fctype = &use_facet<__ctype_type>(_M_buf_locale);
|
||||||
}
|
}
|
||||||
// NB this may require the reconversion of previously
|
// NB this may require the reconversion of previously
|
||||||
// converted chars. This in turn may cause the reconstruction
|
// converted chars. This in turn may cause the reconstruction
|
||||||
|
|
|
@ -276,7 +276,7 @@ namespace std {
|
||||||
_M_grow_words(int __index);
|
_M_grow_words(int __index);
|
||||||
|
|
||||||
// Members for locale and locale caching.
|
// Members for locale and locale caching.
|
||||||
locale _M_locale_ios;
|
locale _M_ios_locale;
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_init();
|
_M_init();
|
||||||
|
@ -367,7 +367,7 @@ namespace std {
|
||||||
imbue(const locale& __loc);
|
imbue(const locale& __loc);
|
||||||
|
|
||||||
inline locale
|
inline locale
|
||||||
getloc() const { return _M_locale_ios; }
|
getloc() const { return _M_ios_locale; }
|
||||||
|
|
||||||
// Storage:
|
// Storage:
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -102,7 +102,7 @@ namespace std {
|
||||||
_M_really_sync(_M_in_cur - _M_in_beg,
|
_M_really_sync(_M_in_cur - _M_in_beg,
|
||||||
_M_out_cur - _M_out_beg);
|
_M_out_cur - _M_out_beg);
|
||||||
*_M_out_cur = traits_type::to_char_type(__c);
|
*_M_out_cur = traits_type::to_char_type(__c);
|
||||||
_M_buf_bump(1);
|
_M_out_cur_move(1);
|
||||||
__retval = __c;
|
__retval = __c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ namespace std {
|
||||||
if (__testout
|
if (__testout
|
||||||
&& __newoffo + __off >= 0 && __endo - __beg >= __newoffo + __off)
|
&& __newoffo + __off >= 0 && __endo - __beg >= __newoffo + __off)
|
||||||
{
|
{
|
||||||
_M_buf_bump(__newoffo + __off - (_M_out_cur - __beg));
|
_M_out_cur_move(__newoffo + __off - (_M_out_cur - __beg));
|
||||||
__retval = pos_type(__newoffo);
|
__retval = pos_type(__newoffo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ namespace std {
|
||||||
if (__testin)
|
if (__testin)
|
||||||
_M_in_cur = _M_in_beg + __pos;
|
_M_in_cur = _M_in_beg + __pos;
|
||||||
if (__testout)
|
if (__testout)
|
||||||
_M_buf_bump((__pos) - (_M_out_cur - __beg));
|
_M_out_cur_move((__pos) - (_M_out_cur - __beg));
|
||||||
__retval = pos_type(off_type(__pos));
|
__retval = pos_type(off_type(__pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,20 +47,19 @@ namespace std {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef _Traits traits_type;
|
typedef _Traits traits_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
typedef typename traits_type::int_type int_type;
|
||||||
typedef typename _Traits::pos_type pos_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef typename _Traits::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
|
|
||||||
// Non-standard Types:
|
// Non-standard Types:
|
||||||
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
|
typedef basic_streambuf<char_type, traits_type> __streambuf_type;
|
||||||
typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
|
typedef basic_filebuf<char_type, traits_type> __filebuf_type;
|
||||||
typedef __basic_file __file_type;
|
typedef __basic_file __file_type;
|
||||||
typedef typename _Traits::state_type __state_type;
|
typedef typename traits_type::state_type __state_type;
|
||||||
typedef codecvt<_CharT, char, __state_type> __codecvt_type;
|
typedef codecvt<char_type, char, __state_type> __codecvt_type;
|
||||||
typedef typename __codecvt_type::result __res_type;
|
typedef typename __codecvt_type::result __res_type;
|
||||||
|
|
||||||
friend ios_base; // For sync_with_stdio.
|
friend ios_base; // For sync_with_stdio.
|
||||||
|
|
||||||
|
@ -197,15 +196,15 @@ namespace std {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
typedef _Traits traits_type;
|
||||||
typedef typename _Traits::pos_type pos_type;
|
typedef typename traits_type::int_type int_type;
|
||||||
typedef typename _Traits::off_type off_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef _Traits traits_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
// Non-standard types:
|
// Non-standard types:
|
||||||
typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
|
typedef basic_filebuf<char_type, traits_type> __filebuf_type;
|
||||||
typedef basic_istream<_CharT, _Traits> __istream_type;
|
typedef basic_istream<char_type, traits_type> __istream_type;
|
||||||
|
|
||||||
// Constructors/Destructors:
|
// Constructors/Destructors:
|
||||||
basic_ifstream()
|
basic_ifstream()
|
||||||
|
@ -251,17 +250,17 @@ namespace std {
|
||||||
class basic_ofstream : public basic_ostream<_CharT,_Traits>
|
class basic_ofstream : public basic_ostream<_CharT,_Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
typedef _Traits traits_type;
|
||||||
typedef typename _Traits::pos_type pos_type;
|
typedef typename traits_type::int_type int_type;
|
||||||
typedef typename _Traits::off_type off_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef _Traits traits_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
// Non-standard types:
|
// Non-standard types:
|
||||||
typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
|
typedef basic_filebuf<char_type, traits_type> __filebuf_type;
|
||||||
typedef basic_ostream<_CharT, _Traits> __ostream_type;
|
typedef basic_ostream<char_type, traits_type> __ostream_type;
|
||||||
|
|
||||||
// Constructors:
|
// Constructors:
|
||||||
basic_ofstream()
|
basic_ofstream()
|
||||||
: __ostream_type(new __filebuf_type())
|
: __ostream_type(new __filebuf_type())
|
||||||
|
@ -312,17 +311,17 @@ namespace std {
|
||||||
class basic_fstream : public basic_iostream<_CharT, _Traits>
|
class basic_fstream : public basic_iostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
typedef _Traits traits_type;
|
||||||
typedef typename _Traits::pos_type pos_type;
|
typedef typename traits_type::int_type int_type;
|
||||||
typedef typename _Traits::off_type off_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef _Traits traits_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
// Non-standard types:
|
// Non-standard types:
|
||||||
typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
|
typedef basic_filebuf<char_type, traits_type> __filebuf_type;
|
||||||
typedef basic_ios<_CharT, _Traits> __ios_type;
|
typedef basic_ios<char_type, traits_type> __ios_type;
|
||||||
typedef basic_iostream<_CharT, _Traits> __iostream_type;
|
typedef basic_iostream<char_type, traits_type> __iostream_type;
|
||||||
|
|
||||||
// Constructors/destructor:
|
// Constructors/destructor:
|
||||||
basic_fstream()
|
basic_fstream()
|
||||||
|
|
|
@ -45,13 +45,14 @@ namespace std {
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
typedef _Traits traits_type;
|
||||||
typedef typename _Traits::pos_type pos_type;
|
typedef typename traits_type::int_type int_type;
|
||||||
typedef typename _Traits::off_type off_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef _Traits traits_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
// Non-standard types:
|
|
||||||
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
|
// Non-standard Types:
|
||||||
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
typedef basic_streambuf<char_type, traits_type> __streambuf_type;
|
||||||
|
typedef basic_string<char_type, _Traits, _Alloc> __string_type;
|
||||||
typedef typename __string_type::size_type __size_type;
|
typedef typename __string_type::size_type __size_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -192,16 +193,16 @@ namespace std {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
typedef _Traits traits_type;
|
||||||
typedef typename _Traits::pos_type pos_type;
|
typedef typename traits_type::int_type int_type;
|
||||||
typedef typename _Traits::off_type off_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef _Traits traits_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
// Non-standard types:
|
// Non-standard types:
|
||||||
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
||||||
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
||||||
typedef basic_istream<_CharT, _Traits> __istream_type;
|
typedef basic_istream<char_type, traits_type> __istream_type;
|
||||||
|
|
||||||
// Constructors:
|
// Constructors:
|
||||||
explicit
|
explicit
|
||||||
|
@ -245,15 +246,16 @@ namespace std {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
typedef _Traits traits_type;
|
||||||
typedef typename _Traits::pos_type pos_type;
|
typedef typename traits_type::int_type int_type;
|
||||||
typedef typename _Traits::off_type off_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef _Traits traits_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
// Non-standard types:
|
// Non-standard types:
|
||||||
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
||||||
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
||||||
typedef basic_ostream<_CharT, _Traits> __ostream_type;
|
typedef basic_ostream<char_type, traits_type> __ostream_type;
|
||||||
|
|
||||||
// Constructors/destructor:
|
// Constructors/destructor:
|
||||||
explicit
|
explicit
|
||||||
|
@ -296,16 +298,17 @@ namespace std {
|
||||||
class basic_stringstream : public basic_iostream<_CharT, _Traits>
|
class basic_stringstream : public basic_iostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
typedef _Traits traits_type;
|
||||||
typedef typename _Traits::pos_type pos_type;
|
typedef typename traits_type::int_type int_type;
|
||||||
typedef typename _Traits::off_type off_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef _Traits traits_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
// Non-standard types:
|
|
||||||
|
// Non-standard Types:
|
||||||
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
||||||
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
||||||
typedef basic_iostream<_CharT, _Traits> __iostream_type;
|
typedef basic_iostream<char_type, traits_type> __iostream_type;
|
||||||
|
|
||||||
// Constructors/destructors
|
// Constructors/destructors
|
||||||
explicit
|
explicit
|
||||||
|
|
|
@ -55,14 +55,14 @@ namespace std {
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
typedef typename _Traits::int_type int_type;
|
|
||||||
typedef typename _Traits::pos_type pos_type;
|
|
||||||
typedef typename _Traits::off_type off_type;
|
|
||||||
typedef _Traits traits_type;
|
typedef _Traits traits_type;
|
||||||
|
typedef typename traits_type::int_type int_type;
|
||||||
|
typedef typename traits_type::pos_type pos_type;
|
||||||
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
// Non-standard Types:
|
// Non-standard Types:
|
||||||
typedef ctype<_CharT> __ctype_type;
|
typedef ctype<char_type> __ctype_type;
|
||||||
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
|
typedef basic_streambuf<char_type, traits_type> __streambuf_type;
|
||||||
|
|
||||||
friend class basic_ios<char_type, traits_type>;
|
friend class basic_ios<char_type, traits_type>;
|
||||||
friend class basic_istream<char_type, traits_type>;
|
friend class basic_istream<char_type, traits_type>;
|
||||||
|
@ -71,9 +71,8 @@ namespace std {
|
||||||
friend class ostreambuf_iterator<char_type, traits_type>;
|
friend class ostreambuf_iterator<char_type, traits_type>;
|
||||||
|
|
||||||
friend streamsize
|
friend streamsize
|
||||||
_S_copy_streambufs<>(basic_ios<_CharT, _Traits>& __ios,
|
_S_copy_streambufs<>(basic_ios<char_type, traits_type>& __ios,
|
||||||
basic_streambuf<_CharT, _Traits>* __sbin,
|
__streambuf_type* __sbin,__streambuf_type* __sbout);
|
||||||
basic_streambuf<_CharT, _Traits>* __sbout);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -110,13 +109,13 @@ namespace std {
|
||||||
ios_base::openmode _M_mode;
|
ios_base::openmode _M_mode;
|
||||||
|
|
||||||
// Current locale setting.
|
// Current locale setting.
|
||||||
locale _M_locale_buf;
|
locale _M_buf_locale;
|
||||||
|
|
||||||
// True iff locale is initialized.
|
// True iff locale is initialized.
|
||||||
bool _M_locale_set;
|
bool _M_buf_locale_init;
|
||||||
|
|
||||||
// Cached use_facet<ctype>, which is based on the current locale info.
|
// Cached use_facet<ctype>, which is based on the current locale info.
|
||||||
const __ctype_type* _M_fctype_buf;
|
const __ctype_type* _M_buf_fctype;
|
||||||
|
|
||||||
// Correctly sets the _M_out_cur pointer, and bumps the
|
// Correctly sets the _M_out_cur pointer, and bumps the
|
||||||
// appropriate _M_*_end pointers as well. Necessary for the
|
// appropriate _M_*_end pointers as well. Necessary for the
|
||||||
|
@ -127,23 +126,24 @@ namespace std {
|
||||||
// the same range:
|
// the same range:
|
||||||
// _M_buf <= _M_*_ <= _M_buf + _M_buf_size
|
// _M_buf <= _M_*_ <= _M_buf + _M_buf_size
|
||||||
void
|
void
|
||||||
_M_buf_bump(off_type __n) // argument needs to be +-
|
_M_out_cur_move(off_type __n) // argument needs to be +-
|
||||||
{
|
{
|
||||||
bool __testin = _M_mode & ios_base::in;
|
bool __testin = _M_mode & ios_base::in;
|
||||||
bool __testout = _M_mode & ios_base::out;
|
|
||||||
_M_out_cur += __n;
|
_M_out_cur += __n;
|
||||||
if (_M_buf_unified && __testin)
|
if (__testin && _M_buf_unified)
|
||||||
_M_in_cur = _M_out_cur;
|
_M_in_cur += __n;
|
||||||
if (_M_out_cur > _M_out_end)
|
if (_M_out_cur > _M_out_end)
|
||||||
{
|
{
|
||||||
_M_out_end = _M_out_cur;
|
_M_out_end = _M_out_cur;
|
||||||
if (__testin && __testout && _M_out_end > _M_in_end)
|
// NB: in | out buffers drag the _M_in_end pointer along...
|
||||||
_M_in_end = _M_out_cur;
|
if (__testin)
|
||||||
|
_M_in_end += __n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// These three functions are used to clarify internal buffer
|
// These three functions are used to clarify internal buffer
|
||||||
// maintance. After an overflow, or after a seekoff call that
|
// maintenance. After an overflow, or after a seekoff call that
|
||||||
// started at beg or end, or possibly when the stream becomes
|
// started at beg or end, or possibly when the stream becomes
|
||||||
// unbuffered, and a myrid other obscure corner cases, the
|
// unbuffered, and a myrid other obscure corner cases, the
|
||||||
// internal buffer does not truly reflect the contents of the
|
// internal buffer does not truly reflect the contents of the
|
||||||
|
@ -193,8 +193,8 @@ namespace std {
|
||||||
_M_buf_size = 0;
|
_M_buf_size = 0;
|
||||||
_M_buf_size_opt = 0;
|
_M_buf_size_opt = 0;
|
||||||
_M_mode = ios_base::openmode(0);
|
_M_mode = ios_base::openmode(0);
|
||||||
_M_fctype_buf = NULL;
|
_M_buf_fctype = NULL;
|
||||||
_M_locale_set = false;
|
_M_buf_locale_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Locales:
|
// Locales:
|
||||||
|
@ -209,8 +209,8 @@ namespace std {
|
||||||
locale
|
locale
|
||||||
getloc() const
|
getloc() const
|
||||||
{
|
{
|
||||||
if (_M_locale_set)
|
if (_M_buf_locale_init)
|
||||||
return _M_locale_buf;
|
return _M_buf_locale;
|
||||||
else
|
else
|
||||||
return locale();
|
return locale();
|
||||||
}
|
}
|
||||||
|
@ -292,10 +292,10 @@ namespace std {
|
||||||
_M_buf_size_opt(static_cast<int_type>(BUFSIZ * sizeof(char_type))),
|
_M_buf_size_opt(static_cast<int_type>(BUFSIZ * sizeof(char_type))),
|
||||||
_M_buf_unified(false), _M_in_cur(0), _M_in_beg(0), _M_in_end(0),
|
_M_buf_unified(false), _M_in_cur(0), _M_in_beg(0), _M_in_end(0),
|
||||||
_M_out_cur(0), _M_out_beg(0), _M_out_end(0),
|
_M_out_cur(0), _M_out_beg(0), _M_out_end(0),
|
||||||
_M_mode(ios_base::openmode(0)), _M_locale_buf(locale()),
|
_M_mode(ios_base::openmode(0)), _M_buf_locale(locale()),
|
||||||
_M_locale_set(false)
|
_M_buf_locale_init(false)
|
||||||
|
|
||||||
{ _M_fctype_buf = &use_facet<__ctype_type>(this->getloc()); }
|
{ _M_buf_fctype = &use_facet<__ctype_type>(this->getloc()); }
|
||||||
|
|
||||||
// Get area:
|
// Get area:
|
||||||
char_type*
|
char_type*
|
||||||
|
@ -353,11 +353,11 @@ namespace std {
|
||||||
virtual void
|
virtual void
|
||||||
imbue(const locale& __loc)
|
imbue(const locale& __loc)
|
||||||
{
|
{
|
||||||
_M_locale_set = true;
|
_M_buf_locale_init = true;
|
||||||
if (_M_locale_buf != __loc)
|
if (_M_buf_locale != __loc)
|
||||||
{
|
{
|
||||||
_M_locale_buf = __loc;
|
_M_buf_locale = __loc;
|
||||||
_M_fctype_buf = &use_facet<__ctype_type>(_M_locale_buf);
|
_M_buf_fctype = &use_facet<__ctype_type>(_M_buf_locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace std {
|
||||||
if (_M_out_cur && _M_out_cur < _M_out_beg + _M_buf_size)
|
if (_M_out_cur && _M_out_cur < _M_out_beg + _M_buf_size)
|
||||||
{
|
{
|
||||||
*_M_out_cur = __c;
|
*_M_out_cur = __c;
|
||||||
_M_buf_bump(1);
|
_M_out_cur_move(1);
|
||||||
__retval = traits_type::to_int_type(__c);
|
__retval = traits_type::to_int_type(__c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -198,7 +198,7 @@ namespace std {
|
||||||
traits_type::copy(_M_out_cur, __s, __len);
|
traits_type::copy(_M_out_cur, __s, __len);
|
||||||
__retval += __len;
|
__retval += __len;
|
||||||
__s += __len;
|
__s += __len;
|
||||||
_M_buf_bump(__len);
|
_M_out_cur_move(__len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ namespace std {
|
||||||
_M_callbacks = 0;
|
_M_callbacks = 0;
|
||||||
_M_words = 0;
|
_M_words = 0;
|
||||||
_M_word_limit = 0;
|
_M_word_limit = 0;
|
||||||
_M_locale_ios = locale();
|
_M_ios_locale = locale();
|
||||||
// No init needed for _M_word_array or _M_dummy.
|
// No init needed for _M_word_array or _M_dummy.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,8 +209,8 @@ namespace std {
|
||||||
locale
|
locale
|
||||||
ios_base::imbue(const locale& __loc)
|
ios_base::imbue(const locale& __loc)
|
||||||
{
|
{
|
||||||
locale __old = _M_locale_ios;
|
locale __old = _M_ios_locale;
|
||||||
_M_locale_ios = __loc;
|
_M_ios_locale = __loc;
|
||||||
// Make sure there's a callback for the format caches so they will be
|
// Make sure there's a callback for the format caches so they will be
|
||||||
// marked dirty.
|
// marked dirty.
|
||||||
_Format_cache<char>::_S_get(*this);
|
_Format_cache<char>::_S_get(*this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue