epoc32/include/stdapis/stlport/stl/_sstream.c
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_sstream.c	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,671 +0,0 @@
     1.4 -/*
     1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 - * Copyright (c) 1999
     1.7 - * Silicon Graphics Computer Systems, Inc.
     1.8 - *
     1.9 - * Copyright (c) 1999 
    1.10 - * Boris Fomitchev
    1.11 - *
    1.12 - * This material is provided "as is", with absolutely no warranty expressed
    1.13 - * or implied. Any use is at your own risk.
    1.14 - *
    1.15 - * Permission to use or copy this software for any purpose is hereby granted 
    1.16 - * without fee, provided the above notices are retained on all copies.
    1.17 - * Permission to modify the code and to distribute modified code is granted,
    1.18 - * provided the above notices are retained, and a notice that the code was
    1.19 - * modified is included with the above copyright notice.
    1.20 - *
    1.21 - */ 
    1.22 -
    1.23 -#ifndef _STLP_SSTREAM_C
    1.24 -#define _STLP_SSTREAM_C
    1.25 -
    1.26 -#ifndef _STLP_SSTREAM_H
    1.27 -# include <stl/_sstream.h>
    1.28 -#include <stl/_stdio_file.h> 
    1.29 -#endif
    1.30 -
    1.31 -# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
    1.32 -
    1.33 -# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
    1.34 -// no wint_t is supported for this mode
    1.35 -# define __BSB_int_type__ int
    1.36 -# define __BSB_pos_type__ streampos
    1.37 -# else
    1.38 -# define __BSB_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
    1.39 -# define __BSB_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
    1.40 -# endif
    1.41 -
    1.42 -_STLP_BEGIN_NAMESPACE
    1.43 -
    1.44 -//----------------------------------------------------------------------
    1.45 -// Non-inline stringbuf member functions.
    1.46 -
    1.47 -// Constructors.  Note that the base class constructor sets all of the
    1.48 -// get and area pointers to null.
    1.49 -
    1.50 -template <class _CharT, class _Traits, class _Alloc>
    1.51 -_STLP_EXP_DECLSPEC basic_stringbuf<_CharT, _Traits, _Alloc>
    1.52 -  ::basic_stringbuf(ios_base::openmode __mode)
    1.53 -    : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str()
    1.54 -{
    1.55 -#ifdef __SYMBIAN32__
    1.56 -if (_M_mode & ios_base::out) {
    1.57 -   if (_M_mode & (ios_base::app | ios_base::ate))
    1.58 -       //increment the streampos to reflect the current streampos while writing
    1.59 -       _M_str._M_stream_pos += _M_str.size();
    1.60 -}
    1.61 -#endif
    1.62 -}
    1.63 -
    1.64 -template <class _CharT, class _Traits, class _Alloc>
    1.65 -_STLP_EXP_DECLSPEC basic_stringbuf<_CharT, _Traits, _Alloc>
    1.66 -  ::basic_stringbuf(const basic_string<_CharT, _Traits, _Alloc>& __s, ios_base::openmode __mode)
    1.67 -    : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str(__s)
    1.68 -{
    1.69 -#ifdef __SYMBIAN32__
    1.70 -if (_M_mode & ios_base::out) {
    1.71 -   if (_M_mode & (ios_base::app | ios_base::ate))
    1.72 -     //increment the streampos to reflect the current streampos while writing
    1.73 -     _M_str._M_stream_pos += _M_str.size();
    1.74 -}
    1.75 -#endif
    1.76 -  _M_set_ptrs();
    1.77 -}
    1.78 -
    1.79 -template <class _CharT, class _Traits, class _Alloc>
    1.80 -_STLP_EXP_DECLSPEC basic_stringbuf<_CharT, _Traits, _Alloc>::~basic_stringbuf()
    1.81 -{}
    1.82 -
    1.83 -// Set the underlying string to a new value.
    1.84 -template <class _CharT, class _Traits, class _Alloc>
    1.85 -_STLP_EXP_DECLSPEC void 
    1.86 -basic_stringbuf<_CharT, _Traits, _Alloc>::str(const basic_string<_CharT, _Traits, _Alloc>& __s)
    1.87 -{
    1.88 -  _M_str = __s;
    1.89 -  _M_set_ptrs();
    1.90 -}
    1.91 -
    1.92 -template <class _CharT, class _Traits, class _Alloc>
    1.93 -void 
    1.94 -basic_stringbuf<_CharT, _Traits, _Alloc>::_M_set_ptrs() {
    1.95 -  _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
    1.96 -  _CharT* __data_end = __data_ptr + _M_str.size();
    1.97 -  // The initial read position is the beginning of the string.
    1.98 -  if (_M_mode & ios_base::in) {
    1.99 -    if (_M_mode & ios_base::ate)
   1.100 -      this->setg(__data_ptr, __data_end, __data_end);
   1.101 -    else
   1.102 -      this->setg(__data_ptr, __data_ptr, __data_end);
   1.103 -  }
   1.104 -  
   1.105 -  // The initial write position is the beginning of the string.
   1.106 -  if (_M_mode & ios_base::out) {
   1.107 -    if (_M_mode & (ios_base::app | ios_base::ate))
   1.108 -      this->setp(__data_end, __data_end);
   1.109 -    else
   1.110 -      this->setp(__data_ptr, __data_end);
   1.111 -  }
   1.112 -}
   1.113 -
   1.114 -// Precondition: gptr() >= egptr().  Returns a character, if one is available.
   1.115 -template <class _CharT, class _Traits, class _Alloc>
   1.116 -_STLP_EXP_DECLSPEC __BSB_int_type__
   1.117 -basic_stringbuf<_CharT, _Traits, _Alloc>::underflow()
   1.118 -{
   1.119 -  return this->gptr() != this->egptr()
   1.120 -    ? _Traits::to_int_type(*this->gptr())
   1.121 -    : _Traits::eof();
   1.122 -}
   1.123 -
   1.124 -// Precondition: gptr() >= egptr().
   1.125 -template <class _CharT, class _Traits, class _Alloc>
   1.126 -_STLP_EXP_DECLSPEC __BSB_int_type__
   1.127 -basic_stringbuf<_CharT, _Traits, _Alloc>::uflow()
   1.128 -{
   1.129 -  if (this->gptr() != this->egptr()) {
   1.130 -    int_type __c = _Traits::to_int_type(*this->gptr());
   1.131 -    this->gbump(1);
   1.132 -    return __c;
   1.133 -  }
   1.134 -  else
   1.135 -    return _Traits::eof();
   1.136 -}
   1.137 -
   1.138 -template <class _CharT, class _Traits, class _Alloc>
   1.139 -_STLP_EXP_DECLSPEC __BSB_int_type__
   1.140 -basic_stringbuf<_CharT, _Traits, _Alloc>::pbackfail(int_type __c)
   1.141 -{
   1.142 -  if (this->gptr() != this->eback()) {
   1.143 -    if (!_Traits::eq_int_type(__c, _Traits::eof())) {
   1.144 -
   1.145 -if (_Traits::eq(_Traits::to_char_type(__c), this->gptr()[-1])
   1.146 -      		|| _M_mode == (ios_base::in | ios_base::out)) {
   1.147 -        this->gbump(-1);
   1.148 -      	*this->gptr() = _Traits::to_char_type(__c);
   1.149 -      	return _Traits::not_eof(__c);
   1.150 -      }
   1.151 -      else{
   1.152 -	  	return _Traits::eof();
   1.153 -	  }
   1.154 -    }
   1.155 -    else {
   1.156 -      this->gbump(-1);
   1.157 -      return _Traits::not_eof(__c);
   1.158 -    }
   1.159 -  }
   1.160 -	else
   1.161 -    return _Traits::eof();
   1.162 -}
   1.163 -
   1.164 -template <class _CharT, class _Traits, class _Alloc>
   1.165 -_STLP_EXP_DECLSPEC __BSB_int_type__
   1.166 -basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(int_type __c)
   1.167 -{
   1.168 -  // fbp : reverse order of "ifs" to pass Dietmar's test.
   1.169 -  // Apparently, standard allows overflow with eof even for read-only streams.
   1.170 -  if (!_Traits::eq_int_type(__c, _Traits::eof())) {
   1.171 -    if (_M_mode & ios_base::out) {
   1.172 -      if (!(_M_mode & ios_base::in)) {
   1.173 -        // It's a write-only streambuf, so we can use special append buffer.
   1.174 -        if (this->pptr() == this->epptr())
   1.175 -          this->_M_append_buffer();
   1.176 -      
   1.177 -        if (this->pptr() != this->epptr()) {
   1.178 -          *this->pptr() = _Traits::to_char_type(__c);
   1.179 -          this->pbump(1);
   1.180 -          return __c;
   1.181 -        }
   1.182 -        else
   1.183 -          return _Traits::eof();
   1.184 -      }
   1.185 -
   1.186 -      else {
   1.187 -        // We're not using a special append buffer, just the string itself.
   1.188 -        if (this->pptr() == this->epptr()) {
   1.189 -          ptrdiff_t __offset = this->gptr() - this->eback();
   1.190 -          _M_str.push_back(_Traits::to_char_type(__c));
   1.191 -
   1.192 -	  _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
   1.193 -	  size_t __data_size = _M_str.size();
   1.194 -
   1.195 -          this->setg(__data_ptr, __data_ptr + __offset, __data_ptr+__data_size);
   1.196 -          this->setp(__data_ptr, __data_ptr + __data_size);
   1.197 -          this->pbump((int)__data_size);
   1.198 -          return __c;
   1.199 -        }
   1.200 -        else {
   1.201 -          *this->pptr() = _Traits::to_char_type(__c);
   1.202 -          this->pbump(1);
   1.203 -          return __c;
   1.204 -        }
   1.205 -      }
   1.206 -    }
   1.207 -    else                          // Overflow always fails if it's read-only 
   1.208 -      return _Traits::eof();
   1.209 -  }
   1.210 -  else                        // __c is EOF, so we don't have to do anything
   1.211 -    return _Traits::not_eof(__c);
   1.212 -}
   1.213 -
   1.214 -template <class _CharT, class _Traits, class _Alloc>
   1.215 -_STLP_EXP_DECLSPEC streamsize 
   1.216 -basic_stringbuf<_CharT, _Traits, _Alloc>::xsputn(const char_type* __s,
   1.217 -                                                 streamsize __n)
   1.218 -{
   1.219 -  streamsize __nwritten = 0;
   1.220 -
   1.221 -  if ((_M_mode & ios_base::out) && __n > 0) {
   1.222 -    // If the put pointer is somewhere in the middle of the string,
   1.223 -    // then overwrite instead of append.
   1.224 -    if (this->pbase() == _M_str.data() ) {
   1.225 -      ptrdiff_t __avail = _M_str.data() + _M_str.size() - this->pptr();
   1.226 -      if (__avail > __n) {
   1.227 -        _Traits::copy(this->pptr(), __s, __n);
   1.228 -        this->pbump((int)__n);
   1.229 -#ifdef __SYMBIAN32__
   1.230 -   //     _M_str._M_stream_pos += __n; //increment streampos to number of characters in stream
   1.231 -#endif
   1.232 -        return __n;
   1.233 -      }
   1.234 -      else {
   1.235 -        _Traits::copy(this->pptr(), __s, __avail);
   1.236 -        __nwritten += __avail;
   1.237 -        __n -= __avail;
   1.238 -        __s += __avail;
   1.239 -#ifdef __SYMBIAN32__
   1.240 -  //      _M_str._M_stream_pos += __avail;//increment streampos to number of characters in stream
   1.241 -#endif
   1.242 -        this->setp(_M_Buf, _M_Buf + __STATIC_CAST(int,_S_BufSiz));
   1.243 -      }
   1.244 -    }
   1.245 -
   1.246 -    // At this point we know we're appending.
   1.247 -    if (_M_mode & ios_base::in) {
   1.248 -      ptrdiff_t __get_offset = this->gptr() - this->eback();
   1.249 -      _M_str.append(__s, __s + __n);
   1.250 -      
   1.251 -      _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
   1.252 -      size_t __data_size = _M_str.size();
   1.253 -
   1.254 -      this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr+__data_size);
   1.255 -      this->setp(__data_ptr, __data_ptr + __data_size);
   1.256 -      this->pbump((int)__data_size);
   1.257 -    }
   1.258 -    else {
   1.259 -      _M_append_buffer();
   1.260 -#ifdef __SYMBIAN32__      
   1.261 -      if (_M_str._M_stream_pos >= 0 
   1.262 -          && (_M_str._M_stream_pos < _M_str.size())) {          
   1.263 -          if((_M_str.size() - _M_str._M_stream_pos) >= __n)
   1.264 -          	_M_str.replace(_M_str._M_stream_pos, __n, __s);          
   1.265 -          else
   1.266 -          	{
   1.267 -          	_M_str.replace(_M_str._M_stream_pos, (_M_str.size() - _M_str._M_stream_pos), __s);
   1.268 -          	_M_str.append(__s + (__n - (_M_str.size() - _M_str._M_stream_pos)), __s + __n);
   1.269 -          	}
   1.270 -      } else {
   1.271 -          _M_str.append(__s, __s + __n);
   1.272 -      }
   1.273 -      _M_str._M_stream_pos += __n;
   1.274 -#else //__SYMBIAN32__      
   1.275 -      _M_str.append(__s, __s + __n);
   1.276 -#endif // __SYMBIAN32__      
   1.277 -    }
   1.278 -    __nwritten += __n;
   1.279 -  }
   1.280 -
   1.281 -  return __nwritten;
   1.282 -}
   1.283 -
   1.284 -template <class _CharT, class _Traits, class _Alloc>
   1.285 -streamsize 
   1.286 -basic_stringbuf<_CharT, _Traits, _Alloc>::_M_xsputnc(char_type __c,
   1.287 -                                                     streamsize __n)
   1.288 -{
   1.289 -  streamsize __nwritten = 0;
   1.290 -
   1.291 -  if ((_M_mode & ios_base::out) && __n > 0) {
   1.292 -    // If the put pointer is somewhere in the middle of the string,
   1.293 -    // then overwrite instead of append.
   1.294 -    if (this->pbase() == _M_str.data()) {
   1.295 -      ptrdiff_t __avail = _M_str.data() + _M_str.size() - this->pptr();
   1.296 -      if (__avail > __n) {
   1.297 -        _Traits::assign(this->pptr(), __n, __c);
   1.298 -        this->pbump((int)__n);
   1.299 -        return __n;
   1.300 -      }
   1.301 -      else {
   1.302 -        _Traits::assign(this->pptr(), __avail, __c);
   1.303 -        __nwritten += __avail;
   1.304 -        __n -= __avail;
   1.305 -        this->setp(_M_Buf, _M_Buf + __STATIC_CAST(int,_S_BufSiz));
   1.306 -      }
   1.307 -    }
   1.308 -
   1.309 -    // At this point we know we're appending.
   1.310 -    if (this->_M_mode & ios_base::in) {
   1.311 -      ptrdiff_t __get_offset = this->gptr() - this->eback();
   1.312 -      _M_str.append(__n, __c);
   1.313 -
   1.314 -      _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
   1.315 -      size_t __data_size = _M_str.size();
   1.316 -
   1.317 -      this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr+__data_size);
   1.318 -      this->setp(__data_ptr, __data_ptr + __data_size);
   1.319 -      this->pbump((int)__data_size);
   1.320 -
   1.321 -    }
   1.322 -    else {
   1.323 -      _M_append_buffer();
   1.324 -//      _M_str.append(__n, __c);
   1.325 -#ifdef __SYMBIAN32__      
   1.326 -      if (_M_str._M_stream_pos >= 0 
   1.327 -          && (_M_str._M_stream_pos < _M_str.size())) {          
   1.328 -          if((_M_str.size() - _M_str._M_stream_pos) >= __n)
   1.329 -          	_M_str.replace(_M_str._M_stream_pos,__n, __n, __c);          
   1.330 -          else
   1.331 -          	{
   1.332 -          	_M_str.replace(_M_str._M_stream_pos, (_M_str.size() - _M_str._M_stream_pos), (_M_str.size() - _M_str._M_stream_pos), __c);
   1.333 -          	_M_str.append(__n, __c);
   1.334 -          	}
   1.335 -      } else {
   1.336 -          _M_str.append(__n, __c);
   1.337 -      }
   1.338 -      _M_str._M_stream_pos += __n;
   1.339 -#else //__SYMBIAN32__      
   1.340 -      _M_str.append(__n, __c);
   1.341 -#endif // __SYMBIAN32__      
   1.342 -    }
   1.343 -
   1.344 -    __nwritten += __n;
   1.345 -  }
   1.346 -
   1.347 -  return __nwritten;
   1.348 -}
   1.349 -
   1.350 -// According to the C++ standard the effects of setbuf are implementation
   1.351 -// defined, except that setbuf(0, 0) has no effect.  In this implementation,
   1.352 -// setbuf(<anything>, n), for n > 0, calls reserve(n) on the underlying
   1.353 -// string.
   1.354 -template <class _CharT, class _Traits, class _Alloc>
   1.355 -_STLP_EXP_DECLSPEC basic_streambuf<_CharT, _Traits>*
   1.356 -#ifdef __SYMBIAN32__
   1.357 -basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT* __s, streamsize __n)
   1.358 -#else
   1.359 -basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n)
   1.360 -#endif //__SYMBIAN32__
   1.361 -{
   1.362 -  if (__n > 0) {
   1.363 -    bool __do_get_area = false;
   1.364 -    bool __do_put_area = false;
   1.365 -    ptrdiff_t __offg = 0;
   1.366 -    ptrdiff_t __offp = 0;
   1.367 -
   1.368 -    if (this->pbase() == _M_str.data()) {
   1.369 -      __do_put_area = true;
   1.370 -      __offp = this->pptr() - this->pbase();
   1.371 -    }
   1.372 -
   1.373 -    if (this->eback() == _M_str.data()) {
   1.374 -      __do_get_area = true;
   1.375 -      __offg = this->gptr() - this->eback();
   1.376 -    }
   1.377 -
   1.378 -    if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
   1.379 -      _M_append_buffer();
   1.380 -
   1.381 -    _M_str.reserve(__n);
   1.382 -
   1.383 -    _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
   1.384 -#ifdef __SYMBIAN32__
   1.385 -    size_t __data_size = __n;
   1.386 -    memmove(__data_ptr, __s, __n*sizeof(_CharT));    
   1.387 -    _M_str._M_start = __data_ptr;
   1.388 -    _M_str._M_finish = __data_ptr+__n;
   1.389 -#else
   1.390 -    size_t __data_size = _M_str.size();
   1.391 -#endif //__SYMBIAN32__
   1.392 -
   1.393 -    if (__do_get_area) {
   1.394 -#ifdef __SYMBIAN32__
   1.395 -      this->setg(__data_ptr, __data_ptr, __data_ptr+__data_size);
   1.396 -#else
   1.397 -      this->setg(__data_ptr, __data_ptr + __offg, __data_ptr+__data_size);
   1.398 -#endif //__SYMBIAN32__      
   1.399 -    }
   1.400 -
   1.401 -    if (__do_put_area) {
   1.402 -      this->setp(__data_ptr, __data_ptr+__data_size);
   1.403 -#ifndef __SYMBIAN32__
   1.404 -      this->pbump((int)__offp);
   1.405 -#endif //__SYMBIAN32__      
   1.406 -    }
   1.407 -  }
   1.408 -
   1.409 -  return this;
   1.410 -}
   1.411 -
   1.412 -template <class _CharT, class _Traits, class _Alloc>
   1.413 -_STLP_EXP_DECLSPEC __BSB_pos_type__
   1.414 -basic_stringbuf<_CharT, _Traits, _Alloc>::seekoff(off_type __off, 
   1.415 -            ios_base::seekdir __dir,
   1.416 -            ios_base::openmode __mode)
   1.417 -{
   1.418 -  bool __stl_in  = false;
   1.419 -  bool __stl_out = false;
   1.420 -  
   1.421 -  if ((__mode & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out) ) {
   1.422 -    if (__dir == ios_base::beg || __dir == ios_base::end)
   1.423 -      __stl_in = __stl_out = true;
   1.424 -  }
   1.425 -  else if (__mode & ios_base::in)
   1.426 -    __stl_in = true;
   1.427 -  else if (__mode & ios_base::out)
   1.428 -    __stl_out = true;
   1.429 -
   1.430 -  if (!__stl_in && !__stl_out)
   1.431 -    return pos_type(off_type(-1));
   1.432 -  else if ((__stl_in  && (!(_M_mode & ios_base::in) || this->gptr() == 0)) ||
   1.433 -           (__stl_out && (!(_M_mode & ios_base::out) || this->pptr() == 0)))
   1.434 -    return pos_type(off_type(-1));
   1.435 -
   1.436 -#ifdef __SYMBIAN32__
   1.437 -  if (_M_mode & ios_base::out)
   1.438 -#else
   1.439 -  if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
   1.440 -#endif
   1.441 -    _M_append_buffer();
   1.442 -
   1.443 -  streamoff __newoff;
   1.444 -  switch(__dir) {
   1.445 -  case ios_base::beg:
   1.446 -    __newoff = 0;
   1.447 -    break;
   1.448 -  case ios_base::end:
   1.449 -    __newoff = _M_str.size();
   1.450 -    break;
   1.451 -  case ios_base::cur:
   1.452 -    __newoff = __stl_in ? this->gptr() - this->eback() 
   1.453 -#ifdef __SYMBIAN32__    
   1.454 -                    : ((this->pbase() != this->_M_str) ? _M_str._M_stream_pos
   1.455 -                    : this->pptr() - this->pbase());
   1.456 -#else
   1.457 -                    : this->pptr() - this->pbase();
   1.458 -#endif //__SYMBIAN32__                                                            
   1.459 -    break;
   1.460 -  default:
   1.461 -    return pos_type(off_type(-1));
   1.462 -  }
   1.463 -
   1.464 -  __off += __newoff;
   1.465 -
   1.466 -  if (__stl_in) {
   1.467 -    ptrdiff_t __n = this->egptr() - this->eback();
   1.468 -
   1.469 -    if (__off < 0 || __off > __n)
   1.470 -      return pos_type(off_type(-1));
   1.471 -    else
   1.472 -      this->setg(this->eback(), this->eback() + __off, this->eback() + __n);
   1.473 -  }
   1.474 -
   1.475 -  if (__stl_out) {
   1.476 -    ptrdiff_t __n;
   1.477 -#ifdef __SYMBIAN32__
   1.478 -    //if (this->pbase() != this->_M_str) {
   1.479 -    void* __data_ptr1 = reinterpret_cast<void*>(this->pbase());
   1.480 -		_CharT* __data_ptr2 = __CONST_CAST(_CharT*,this->_M_str.data());
   1.481 -				
   1.482 -       if (__data_ptr1 != __data_ptr2) {
   1.483 -        __n = _M_str.size();
   1.484 -    } else {
   1.485 -#endif // __SYMBIAN32__
   1.486 -    __n = this->epptr() - this->pbase();
   1.487 -#ifdef __SYMBIAN32__
   1.488 -    }
   1.489 -#endif //__SYMBIAN32__        
   1.490 -    if (__off < 0 || __off > __n)
   1.491 -      return pos_type(off_type(-1));
   1.492 -    else {
   1.493 -#ifdef __SYMBIAN32__
   1.494 -		void* __data_ptr1 = reinterpret_cast<void*>(this->pbase());
   1.495 -		_CharT* __data_ptr2 = __CONST_CAST(_CharT*,this->_M_str.data());
   1.496 -				
   1.497 -       if (__data_ptr1 != __data_ptr2) {
   1.498 -           _M_str._M_stream_pos = __off;
   1.499 -       } else {
   1.500 -#endif //__SYMBIAN32__
   1.501 -      this->setp(this->pbase(), this->pbase() + __n);
   1.502 -      this->pbump((int)__off);
   1.503 -#ifdef __SYMBIAN32__      
   1.504 -      }
   1.505 -#endif // __SYMBIAN32__      
   1.506 -    }
   1.507 -  }
   1.508 -
   1.509 -  return pos_type(__off);
   1.510 -}
   1.511 -
   1.512 -template <class _CharT, class _Traits, class _Alloc>
   1.513 -_STLP_EXP_DECLSPEC __BSB_pos_type__
   1.514 -basic_stringbuf<_CharT, _Traits, _Alloc>
   1.515 -  ::seekpos(pos_type __pos, ios_base::openmode __mode)
   1.516 -{
   1.517 -  bool __stl_in  = (__mode & ios_base::in) != 0;
   1.518 -  bool __stl_out = (__mode & ios_base::out) != 0;
   1.519 -
   1.520 -  if ((__stl_in  && (!(_M_mode & ios_base::in) || this->gptr() == 0)) ||
   1.521 -      (__stl_out && (!(_M_mode & ios_base::out) || this->pptr() == 0)) ||
   1.522 -      (!__stl_in && !__stl_out))
   1.523 -    return pos_type(off_type(-1));
   1.524 -
   1.525 -  const off_type __n = __pos - pos_type(off_type(0));
   1.526 -  if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
   1.527 -    _M_append_buffer();
   1.528 -
   1.529 -  if (__stl_in) {
   1.530 -    if (__n < 0 || __n > this->egptr() - this->eback())
   1.531 -      return pos_type(off_type(-1));
   1.532 -    this->setg(this->eback(), this->eback() + __n, this->egptr());
   1.533 -  }
   1.534 -
   1.535 -  if (__stl_out) {
   1.536 -    if (__n < 0 || size_t(__n) > _M_str.size())
   1.537 -      return pos_type(off_type(-1));
   1.538 -
   1.539 -    _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
   1.540 -    size_t __data_size = _M_str.size();
   1.541 -    
   1.542 -    this->setp(__data_ptr, __data_ptr+__data_size);
   1.543 -    this->pbump((int)__n);
   1.544 -  }
   1.545 -
   1.546 -  return __pos;
   1.547 -}
   1.548 -
   1.549 -// This is declared as a const member function because it is 
   1.550 -// called by basic_stringbuf<>::str().  Precondition: this is a
   1.551 -// write-only stringbuf.  We can't use an output buffer for read-
   1.552 -// write stringbufs.  Postcondition: pptr is reset to the beginning
   1.553 -// of the buffer.
   1.554 -template <class _CharT, class _Traits, class _Alloc>
   1.555 -void basic_stringbuf<_CharT, _Traits, _Alloc>::_M_append_buffer() const
   1.556 -
   1.557 -{
   1.558 -  // Do we have a buffer to append?
   1.559 -  if (this->pbase() == this->_M_Buf && this->pptr() != this->_M_Buf) {
   1.560 -    basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this);
   1.561 -#ifdef __SYMBIAN32__    
   1.562 -    size_t __n = this->pptr() - this->pbase();
   1.563 -    if (__this->_M_str._M_stream_pos >= 0 
   1.564 -        && (__this->_M_str._M_stream_pos != __this->_M_str.size())) {
   1.565 -        {
   1.566 -        *(this->pptr()) = (_CharT)0;
   1.567 -#ifdef  __SYMBIAN32__
   1.568 -        __this->_M_str.replace(_M_str._M_stream_pos, __n, (const _CharT*)this->pbase(), (const _CharT*)this->pptr()-(const _CharT*)this->pbase());
   1.569 -#else
   1.570 -	__this->_M_str.replace(_M_str._M_stream_pos, __n, (const _CharT*)this->pbase());
   1.571 -
   1.572 -#endif
   1.573 -        }
   1.574 -    } else {
   1.575 -        __this->_M_str.append((const _CharT*)this->pbase(), (const _CharT*)this->pptr());
   1.576 -    }
   1.577 -    __this->_M_str._M_stream_pos += __n;
   1.578 -#else // __SYMBAIN32__    
   1.579 -    __this->_M_str.append((const _CharT*)this->pbase(), (const _CharT*)this->pptr());
   1.580 -#endif // __SYMBIAN32__    
   1.581 -    __this->setp(__CONST_CAST(_CharT*,_M_Buf),
   1.582 -                 __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
   1.583 -  }
   1.584 -
   1.585 -  // Have we run off the end of the string?
   1.586 -  else if (this->pptr() == this->epptr()) {
   1.587 -    basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this);
   1.588 -    __this->setp(__CONST_CAST(_CharT*,_M_Buf),
   1.589 -                 __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
   1.590 -  __this->_M_str._M_stream_pos = __this->_M_str._M_finish - __this->_M_str._M_start;
   1.591 -  }
   1.592 -}
   1.593 -
   1.594 -//----------------------------------------------------------------------
   1.595 -// Non-inline istringstream member functions.
   1.596 -
   1.597 -template <class _CharT, class _Traits, class _Alloc>
   1.598 -basic_istringstream<_CharT, _Traits, _Alloc>
   1.599 -  ::basic_istringstream(ios_base::openmode __mode)
   1.600 -    : basic_istream<_CharT, _Traits>(0),
   1.601 -      _M_buf(__mode | ios_base::in)
   1.602 -{
   1.603 -  this->init(&_M_buf);
   1.604 -}
   1.605 -
   1.606 -template <class _CharT, class _Traits, class _Alloc>
   1.607 -basic_istringstream<_CharT, _Traits, _Alloc>
   1.608 -  ::basic_istringstream(const _String& __str,ios_base::openmode __mode)
   1.609 -    : basic_istream<_CharT, _Traits>(0),
   1.610 -      _M_buf(__str, __mode | ios_base::in)
   1.611 -{
   1.612 -  this->init(&_M_buf);
   1.613 -}
   1.614 -
   1.615 -template <class _CharT, class _Traits, class _Alloc>
   1.616 -basic_istringstream<_CharT, _Traits, _Alloc>::~basic_istringstream()
   1.617 -{}
   1.618 -
   1.619 -//----------------------------------------------------------------------
   1.620 -// Non-inline ostringstream member functions.
   1.621 -
   1.622 -template <class _CharT, class _Traits, class _Alloc>
   1.623 -basic_ostringstream<_CharT, _Traits, _Alloc>
   1.624 -  ::basic_ostringstream(ios_base::openmode __mode)
   1.625 -    : basic_ostream<_CharT, _Traits>(0),
   1.626 -      _M_buf(__mode | ios_base::out)
   1.627 -{
   1.628 -  this->init(&_M_buf);
   1.629 -}
   1.630 -  
   1.631 -template <class _CharT, class _Traits, class _Alloc>
   1.632 -basic_ostringstream<_CharT, _Traits, _Alloc>
   1.633 -  ::basic_ostringstream(const _String& __str, ios_base::openmode __mode)
   1.634 -    : basic_ostream<_CharT, _Traits>(0),
   1.635 -      _M_buf(__str, __mode | ios_base::out)
   1.636 -{
   1.637 -  this->init(&_M_buf);
   1.638 -}
   1.639 -
   1.640 -template <class _CharT, class _Traits, class _Alloc>
   1.641 -basic_ostringstream<_CharT, _Traits, _Alloc>::~basic_ostringstream()
   1.642 -{}
   1.643 -
   1.644 -//----------------------------------------------------------------------
   1.645 -// Non-inline stringstream member functions.
   1.646 -
   1.647 -template <class _CharT, class _Traits, class _Alloc>
   1.648 -_STLP_EXP_DECLSPEC basic_stringstream<_CharT, _Traits, _Alloc>
   1.649 -  ::basic_stringstream(ios_base::openmode __mode)
   1.650 -    : basic_iostream<_CharT, _Traits>(0), _M_buf(__mode)
   1.651 -{
   1.652 -   this->init(&_M_buf);
   1.653 -}
   1.654 -
   1.655 -template <class _CharT, class _Traits, class _Alloc>
   1.656 -_STLP_EXP_DECLSPEC basic_stringstream<_CharT, _Traits, _Alloc>
   1.657 -  ::basic_stringstream(const _String& __str, ios_base::openmode __mode)
   1.658 -    : basic_iostream<_CharT, _Traits>(0), _M_buf(__str, __mode)
   1.659 -{
   1.660 -  this->init(&_M_buf);
   1.661 -}
   1.662 -
   1.663 -template <class _CharT, class _Traits, class _Alloc>
   1.664 -basic_stringstream<_CharT, _Traits, _Alloc>::~basic_stringstream()
   1.665 -{}
   1.666 -
   1.667 -_STLP_END_NAMESPACE
   1.668 -
   1.669 -# undef __BSB_int_type__
   1.670 -# undef __BSB_pos_type__
   1.671 -
   1.672 -# endif /* EXPOSE */
   1.673 -
   1.674 -#endif /* _STLP_SSTREAM_C */