⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _sstream.c

📁 symbian 上的stl_port进过编译的。
💻 C
📖 第 1 页 / 共 2 页
字号:
      this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr + __data_size);      this->setp(__data_ptr, __data_ptr + __data_size);      this->pbump((int)__data_size);    }    else {      _M_append_buffer();      _M_str.append(__app_size, __c);    }    __nwritten += __app_size;  }  return __nwritten;}// According to the C++ standard the effects of setbuf are implementation// defined, except that setbuf(0, 0) has no effect.  In this implementation,// setbuf(<anything>, n), for n > 0, calls reserve(n) on the underlying// string.template <class _CharT, class _Traits, class _Alloc>basic_streambuf<_CharT, _Traits>*basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n) {  if (__n > 0) {    bool __do_get_area = false;    bool __do_put_area = false;    ptrdiff_t __offg = 0;    ptrdiff_t __offp = 0;    if (this->pbase() == _M_str.data()) {      __do_put_area = true;      __offp = this->pptr() - this->pbase();    }    if (this->eback() == _M_str.data()) {      __do_get_area = true;      __offg = this->gptr() - this->eback();    }    if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))      _M_append_buffer();    _M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))                                                       : __STATIC_CAST(size_t, __n));    _CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data());    size_t __data_size = _M_str.size();    if (__do_get_area) {      this->setg(__data_ptr, __data_ptr + __offg, __data_ptr + __data_size);    }    if (__do_put_area) {      this->setp(__data_ptr, __data_ptr + __data_size);      this->pbump((int)__offp);    }  }  return this;}template <class _CharT, class _Traits, class _Alloc>__BSB_pos_type__basic_stringbuf<_CharT, _Traits, _Alloc>  ::seekoff(off_type __off,            ios_base::seekdir __dir,            ios_base::openmode __mode) {  __mode &= _M_mode;  bool __imode  = (__mode & ios_base::in) != 0;  bool __omode = (__mode & ios_base::out) != 0;  if ( !(__imode || __omode) )    return pos_type(off_type(-1));  if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )    return pos_type(off_type(-1));  if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))    _M_append_buffer();  streamoff __newoff;  switch(__dir) {  case ios_base::beg:    __newoff = 0;    break;  case ios_base::end:    __newoff = _M_str.size();    break;  case ios_base::cur:    __newoff = __imode ? this->gptr() - this->eback() : this->pptr() - this->pbase();    break;  default:    return pos_type(off_type(-1));  }  __off += __newoff;  if (__imode) {    ptrdiff_t __n = this->egptr() - this->eback();    if (__off < 0 || __off > __n)      return pos_type(off_type(-1));    this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __off),                              this->eback() + __STATIC_CAST(ptrdiff_t, __n));  }  if (__omode) {    ptrdiff_t __n = this->epptr() - this->pbase();    if (__off < 0 || __off > __n)      return pos_type(off_type(-1));    this->setp(this->pbase(), this->pbase() + __n);    this->pbump((int)__off);  }  return pos_type(__off);}template <class _CharT, class _Traits, class _Alloc>__BSB_pos_type__basic_stringbuf<_CharT, _Traits, _Alloc>  ::seekpos(pos_type __pos, ios_base::openmode __mode) {  __mode &= _M_mode;  bool __imode  = (__mode & ios_base::in) != 0;  bool __omode = (__mode & ios_base::out) != 0;  if ( !(__imode || __omode) )    return pos_type(off_type(-1));  if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )    return pos_type(off_type(-1));  const off_type __n = __pos - pos_type(off_type(0));  if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))    _M_append_buffer();  if (__imode) {    if (__n < 0 || __n > this->egptr() - this->eback())      return pos_type(off_type(-1));    this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __n), this->egptr());  }  if (__omode) {    if (__n < 0 || size_t(__n) > _M_str.size())      return pos_type(off_type(-1));    _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());    size_t __data_size = _M_str.size();    this->setp(__data_ptr, __data_ptr+__data_size);    this->pbump((int)__n);  }  return __pos;}// This is declared as a const member function because it is// called by basic_stringbuf<>::str().  Precondition: this is a// write-only stringbuf.  We can't use an output buffer for read-// write stringbufs.  Postcondition: pptr is reset to the beginning// of the buffer.template <class _CharT, class _Traits, class _Alloc>void basic_stringbuf<_CharT, _Traits, _Alloc>::_M_append_buffer() const {  // Do we have a buffer to append?  if (this->pbase() == this->_M_Buf && this->pptr() != this->_M_Buf) {    basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this);    __this->_M_str.append((const _CharT*)this->pbase(), (const _CharT*)this->pptr());#ifndef __MWERKS__    __this->setp(__CONST_CAST(_CharT*,_M_Buf),                 __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz)));#else // CodeWarrior treat const char * and const char [8] as different types    __this->setp((_CharT*)_M_Buf,                 (_CharT*)(_M_Buf + __STATIC_CAST(int,_S_BufSiz)));#endif  }  // Have we run off the end of the string?  else if (this->pptr() == this->epptr()) {    basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this);#ifndef __MWERKS__    __this->setp(__CONST_CAST(_CharT*,_M_Buf),                 __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz)));#else // CodeWarrior treat const char * and const char [8] as different types    __this->setp((_CharT*)_M_Buf,                 (_CharT*)(_M_Buf + __STATIC_CAST(int,_S_BufSiz)));#endif  }}//----------------------------------------------------------------------// Non-inline istringstream member functions.template <class _CharT, class _Traits, class _Alloc>basic_istringstream<_CharT, _Traits, _Alloc>  ::basic_istringstream(ios_base::openmode __mode)    : basic_istream<_CharT, _Traits>(0),      _M_buf(__mode | ios_base::in) {  this->init(&_M_buf);}template <class _CharT, class _Traits, class _Alloc>basic_istringstream<_CharT, _Traits, _Alloc>  ::basic_istringstream(const _String& __str,ios_base::openmode __mode)    : basic_istream<_CharT, _Traits>(0),      _M_buf(__str, __mode | ios_base::in) {  this->init(&_M_buf);}template <class _CharT, class _Traits, class _Alloc>basic_istringstream<_CharT, _Traits, _Alloc>::~basic_istringstream(){}//----------------------------------------------------------------------// Non-inline ostringstream member functions.template <class _CharT, class _Traits, class _Alloc>basic_ostringstream<_CharT, _Traits, _Alloc>  ::basic_ostringstream(ios_base::openmode __mode)    : basic_ostream<_CharT, _Traits>(0),      _M_buf(__mode | ios_base::out) {  this->init(&_M_buf);}template <class _CharT, class _Traits, class _Alloc>basic_ostringstream<_CharT, _Traits, _Alloc>  ::basic_ostringstream(const _String& __str, ios_base::openmode __mode)    : basic_ostream<_CharT, _Traits>(0),      _M_buf(__str, __mode | ios_base::out) {  this->init(&_M_buf);}template <class _CharT, class _Traits, class _Alloc>basic_ostringstream<_CharT, _Traits, _Alloc>::~basic_ostringstream(){}//----------------------------------------------------------------------// Non-inline stringstream member functions.template <class _CharT, class _Traits, class _Alloc>basic_stringstream<_CharT, _Traits, _Alloc>  ::basic_stringstream(ios_base::openmode __mode)    : basic_iostream<_CharT, _Traits>(0), _M_buf(__mode) {   this->init(&_M_buf);}template <class _CharT, class _Traits, class _Alloc>basic_stringstream<_CharT, _Traits, _Alloc>  ::basic_stringstream(const _String& __str, ios_base::openmode __mode)    : basic_iostream<_CharT, _Traits>(0), _M_buf(__str, __mode) {  this->init(&_M_buf);}template <class _CharT, class _Traits, class _Alloc>basic_stringstream<_CharT, _Traits, _Alloc>::~basic_stringstream(){}_STLP_END_NAMESPACE# undef __BSB_int_type__# undef __BSB_pos_type__#endif /* _STLP_SSTREAM_C */// Local Variables:// mode:C++// End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -