epoc32/include/stdapis/stlport/stl/_streambuf.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/stlport/stl/_streambuf.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,537 @@
     1.4 +/*
     1.5 + * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 + *
     1.7 + * Copyright (c) 1999
     1.8 + * Silicon Graphics Computer Systems, Inc.
     1.9 + *
    1.10 + * Copyright (c) 1999 
    1.11 + * Boris Fomitchev
    1.12 + *
    1.13 + * This material is provided "as is", with absolutely no warranty expressed
    1.14 + * or implied. Any use is at your own risk.
    1.15 + *
    1.16 + * Permission to use or copy this software for any purpose is hereby granted 
    1.17 + * without fee, provided the above notices are retained on all copies.
    1.18 + * Permission to modify the code and to distribute modified code is granted,
    1.19 + * provided the above notices are retained, and a notice that the code was
    1.20 + * modified is included with the above copyright notice.
    1.21 + *
    1.22 + */ 
    1.23 +#ifndef _STLP_INTERNAL_STREAMBUF
    1.24 +#define _STLP_INTERNAL_STREAMBUF
    1.25 +
    1.26 +#ifndef _STLP_IOS_BASE_H
    1.27 +#include <stl/_ios_base.h>      // Needed for ios_base bitfield members.
    1.28 +                                // <ios_base> includes <iosfwd>.
    1.29 +#endif
    1.30 +
    1.31 +#ifndef _STLP_STDIO_FILE_H
    1.32 +#include <stl/_stdio_file.h>     // Declaration of struct FILE, and of
    1.33 +                                // functions to manipulate it.
    1.34 +#endif
    1.35 +
    1.36 +_STLP_BEGIN_NAMESPACE
    1.37 +
    1.38 +//----------------------------------------------------------------------
    1.39 +// Class basic_streambuf<>, the base class of the streambuf hierarchy.
    1.40 +
    1.41 +// A basic_streambuf<> manages an input (get) area and an output (put)
    1.42 +// area.  Each is described by three pointers: a beginning, an end, and a
    1.43 +// current position.  basic_streambuf<> contains some very simple member
    1.44 +// functions that manipulate those six pointers, but almost all of the real
    1.45 +// functionality gets delegated to protected virtual member functions.
    1.46 +// All of the public member functions are inline, and most of the protected
    1.47 +// member functions are virtual.
    1.48 +
    1.49 +// Although basic_streambuf<> is not abstract, it is useful only as a base
    1.50 +// class.  Its virtual member functions have default definitions such that
    1.51 +// reading from a basic_streambuf<> will always yield EOF, and writing to a
    1.52 +// basic_streambuf<> will always fail.
    1.53 +
    1.54 +// The second template parameter, _Traits, defaults to char_traits<_CharT>.
    1.55 +// The default is declared in header <iosfwd>, and it isn't declared here
    1.56 +// because C++ language rules do not allow it to be declared twice. 
    1.57 +
    1.58 +template <class _CharT, class _Traits>
    1.59 +#ifdef __SYMBIAN32__
    1.60 +class basic_streambuf 
    1.61 +#else
    1.62 +class basic_streambuf
    1.63 +#endif
    1.64 +{
    1.65 +  friend class basic_istream<_CharT, _Traits>;
    1.66 +  friend class basic_ostream<_CharT, _Traits>;
    1.67 +
    1.68 +public:                         // Typedefs.
    1.69 +  typedef _CharT                     char_type;
    1.70 +  typedef typename _Traits::int_type int_type;
    1.71 +  typedef typename _Traits::pos_type pos_type;
    1.72 +  typedef typename _Traits::off_type off_type;
    1.73 +  typedef _Traits                    traits_type;
    1.74 +
    1.75 +private:                        // Data members.
    1.76 +
    1.77 +  char_type* _M_gbegin;         // Beginning of get area
    1.78 +  char_type* _M_gnext;          // Current position within the get area
    1.79 +  char_type* _M_gend;           // End of get area
    1.80 +
    1.81 +  char_type* _M_pbegin;         // Beginning of put area
    1.82 +  char_type* _M_pnext;          // Current position within the put area
    1.83 +  char_type* _M_pend;           // End of put area
    1.84 +
    1.85 +  locale _M_locale;             // The streambuf's locale object
    1.86 +
    1.87 +public:                         // Extension: locking, for thread safety.
    1.88 +  _STLP_mutex _M_lock;
    1.89 +
    1.90 +public:                         // Destructor.
    1.91 +  _STLP_DECLSPEC virtual ~basic_streambuf();
    1.92 +
    1.93 +protected:                      // The default constructor.
    1.94 +  _STLP_DECLSPEC basic_streambuf();
    1.95 +
    1.96 +protected:                      // Protected interface to the get area.
    1.97 +  char_type* eback() const { return _M_gbegin; } // Beginning
    1.98 +  char_type* gptr()  const { return _M_gnext; }  // Current position
    1.99 +  char_type* egptr() const { return _M_gend; }   // End
   1.100 +  
   1.101 +  void gbump(int __n) { _M_gnext += __n; }
   1.102 +  void setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) {
   1.103 +    _M_gbegin = __gbegin;
   1.104 +    _M_gnext  = __gnext;
   1.105 +    _M_gend   = __gend;
   1.106 +  }
   1.107 +
   1.108 +public:
   1.109 +  // An alternate public interface to the above functions
   1.110 +  // which allows us to avoid using templated friends which
   1.111 +  // are not supported on some compilers.
   1.112 +
   1.113 +  char_type* _M_eback() const { return eback(); }
   1.114 +  char_type* _M_gptr()  const { return gptr(); }
   1.115 +  char_type* _M_egptr() const { return egptr(); }
   1.116 +  void _M_gbump(int __n)      { gbump(__n); }
   1.117 +  void _M_setg(char_type* __gbegin, char_type* __gnext, char_type* __gend)
   1.118 +    { setg(__gbegin, __gnext, __gend); }
   1.119 +
   1.120 +protected:                      // Protected interface to the put area
   1.121 +
   1.122 +  char_type* pbase() const { return _M_pbegin; } // Beginning
   1.123 +  char_type* pptr()  const { return _M_pnext; }  // Current position
   1.124 +  char_type* epptr() const { return _M_pend; }   // End
   1.125 +
   1.126 +  void pbump(int __n) { _M_pnext += __n; }
   1.127 +  void setp(char_type* __pbegin, char_type* __pend) {
   1.128 +    _M_pbegin = __pbegin;
   1.129 +    _M_pnext  = __pbegin;
   1.130 +    _M_pend   = __pend;
   1.131 +  }
   1.132 +
   1.133 +protected:                      // Virtual buffer management functions.
   1.134 +
   1.135 +  _STLP_DECLSPEC virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
   1.136 +
   1.137 +  // Alters the stream position, using an integer offset.  In this
   1.138 +  // class seekoff does nothing; subclasses are expected to override it.
   1.139 +  _STLP_DECLSPEC virtual pos_type seekoff(off_type, ios_base::seekdir,
   1.140 +                           ios_base::openmode = ios_base::in | ios_base::out);
   1.141 +
   1.142 +  // Alters the stream position, using a previously obtained streampos.  In
   1.143 +  // this class seekpos does nothing; subclasses are expected to override it.
   1.144 +  _STLP_DECLSPEC virtual pos_type
   1.145 +  seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
   1.146 +
   1.147 +  // Synchronizes (i.e. flushes) the buffer.  All subclasses are expected to 
   1.148 +  // override this virtual member function.
   1.149 +  _STLP_DECLSPEC virtual int sync();
   1.150 +
   1.151 +
   1.152 +public:                         // Buffer management.
   1.153 +  basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n) 
   1.154 +    { return this->setbuf(__s, __n); }
   1.155 +
   1.156 +  pos_type pubseekoff(off_type __offset, ios_base::seekdir __way,
   1.157 +                      ios_base::openmode __mod = ios_base::in | ios_base::out)
   1.158 +    { return this->seekoff(__offset, __way, __mod); }
   1.159 +
   1.160 +  pos_type pubseekpos(pos_type __sp,
   1.161 +                      ios_base::openmode __mod = ios_base::in | ios_base::out)
   1.162 +    { return this->seekpos(__sp, __mod); }
   1.163 +
   1.164 +  int pubsync() { return this->sync(); }
   1.165 +
   1.166 +protected:                      // Virtual get area functions, as defined in
   1.167 +                                // 17.5.2.4.3 and 17.5.2.4.4 of the standard.
   1.168 +  // Returns a lower bound on the number of characters that we can read,
   1.169 +  // with underflow, before reaching end of file.  (-1 is a special value:
   1.170 +  // it means that underflow will fail.)  Most subclasses should probably
   1.171 +  // override this virtual member function.
   1.172 +  _STLP_DECLSPEC virtual streamsize showmanyc();
   1.173 +
   1.174 +  // Reads up to __n characters.  Return value is the number of 
   1.175 +  // characters read.
   1.176 +  _STLP_DECLSPEC virtual streamsize xsgetn(char_type* __s, streamsize __n);
   1.177 +
   1.178 +  // Called when there is no read position, i.e. when gptr() is null
   1.179 +  // or when gptr() >= egptr().  Subclasses are expected to override
   1.180 +  // this virtual member function.
   1.181 +  _STLP_DECLSPEC virtual int_type underflow();
   1.182 +
   1.183 +  // Similar to underflow(), but used for unbuffered input.  Most 
   1.184 +  // subclasses should probably override this virtual member function.
   1.185 +  _STLP_DECLSPEC virtual int_type uflow();
   1.186 +
   1.187 +  // Called when there is no putback position, i.e. when gptr() is null
   1.188 +  // or when gptr() == eback().  All subclasses are expected to override
   1.189 +  // this virtual member function.
   1.190 +  _STLP_DECLSPEC virtual int_type pbackfail(int_type = traits_type::eof());
   1.191 +
   1.192 +protected:                      // Virtual put area functions, as defined in
   1.193 +                                // 27.5.2.4.5 of the standard.
   1.194 +
   1.195 +  // Writes up to __n characters.  Return value is the number of characters
   1.196 +  // written.
   1.197 +  _STLP_DECLSPEC virtual streamsize xsputn(const char_type* __s, streamsize __n);
   1.198 +
   1.199 +  // Extension: writes up to __n copies of __c.  Return value is the number
   1.200 +  // of characters written.
   1.201 +  _STLP_DECLSPEC virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
   1.202 +
   1.203 +  // Called when there is no write position.  All subclasses are expected to
   1.204 +  // override this virtual member function.
   1.205 +  _STLP_DECLSPEC virtual int_type overflow(int_type = traits_type::eof());
   1.206 +
   1.207 +public:                         // Public members for writing characters.
   1.208 +  // Write a single character.
   1.209 +  int_type sputc(char_type __c) {
   1.210 +    return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c)
   1.211 +      : this->overflow(_Traits::to_int_type(__c)));
   1.212 +  }
   1.213 +
   1.214 +  // Write __n characters.
   1.215 +  streamsize sputn(const char_type* __s, streamsize __n)
   1.216 +    { return this->xsputn(__s, __n); }
   1.217 +
   1.218 +  // Extension: write __n copies of __c.
   1.219 +  streamsize _M_sputnc(char_type __c, streamsize __n)
   1.220 +    { return this->_M_xsputnc(__c, __n); }
   1.221 +
   1.222 +private:                        // Helper functions.
   1.223 +  _STLP_DECLSPEC int_type _M_snextc_aux();
   1.224 +
   1.225 +
   1.226 +public:                         // Public members for reading characters.
   1.227 +  streamsize in_avail() {
   1.228 +    return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc();
   1.229 +  }
   1.230 +  
   1.231 +  // Advance to the next character and return it.
   1.232 +  int_type snextc() {
   1.233 +	return ( _M_gend - _M_gnext > 1 ?
   1.234 +             _Traits::to_int_type(*++_M_gnext) :
   1.235 +             this->_M_snextc_aux());
   1.236 +  }
   1.237 +
   1.238 +  // Return the current character and advance to the next.
   1.239 +  int_type sbumpc() {
   1.240 +    return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext++) 
   1.241 +      : this->uflow();
   1.242 +  }
   1.243 +  
   1.244 +  // Return the current character without advancing to the next.
   1.245 +  int_type sgetc() {
   1.246 +    return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext) 
   1.247 +      : this->underflow();
   1.248 +  }
   1.249 +  
   1.250 +  streamsize sgetn(char_type* __s, streamsize __n)
   1.251 +  { return this->xsgetn(__s, __n); }
   1.252 +  
   1.253 +  int_type sputbackc(char_type __c) {
   1.254 +    return ((_M_gbegin < _M_gnext) && _Traits::eq(__c, *(_M_gnext - 1)))
   1.255 +      ? _Traits::to_int_type(*--_M_gnext)
   1.256 +      : this->pbackfail(_Traits::to_int_type(__c));
   1.257 +  }
   1.258 +  
   1.259 +  int_type sungetc() {
   1.260 +    return (_M_gbegin < _M_gnext)
   1.261 +      ? _Traits::to_int_type(*--_M_gnext)
   1.262 +      : this->pbackfail();
   1.263 +  }
   1.264 +
   1.265 +protected:                      // Virtual locale functions.
   1.266 +
   1.267 +  // This is a hook, called by pubimbue() just before pubimbue()
   1.268 +  // sets the streambuf's locale to __loc.  Note that imbue should
   1.269 +  // not (and cannot, since it has no access to streambuf's private
   1.270 +  // members) set the streambuf's locale itself.
   1.271 +  _STLP_DECLSPEC virtual void imbue(const locale&);
   1.272 +
   1.273 +public:                         // Locale-related functions.
   1.274 +  _STLP_DECLSPEC locale pubimbue(const locale&);
   1.275 +  locale getloc() const { return _M_locale; }
   1.276 +
   1.277 +# ifndef _STLP_NO_ANACHRONISMS
   1.278 +  void stossc() { this->sbumpc(); }
   1.279 +# endif
   1.280 +#if defined(__MVS__) || defined(__OS400__)
   1.281 +private: // Data members.
   1.282 +
   1.283 +  char_type* _M_gbegin; // Beginning of get area
   1.284 +  char_type* _M_gnext; // Current position within the get area
   1.285 +  char_type* _M_gend; // End of get area
   1.286 +
   1.287 +  char_type* _M_pbegin; // Beginning of put area
   1.288 +  char_type* _M_pnext; // Current position within the put area
   1.289 +  char_type* _M_pend; // End of put area
   1.290 +#endif
   1.291 +};
   1.292 +
   1.293 +
   1.294 +//----------------------------------------------------------------------
   1.295 +// Specialization: basic_streambuf<char, char_traits<char> >
   1.296 +
   1.297 +// We implement basic_streambuf<char, char_traits<char> > very differently
   1.298 +// than the general basic_streambuf<> template.  The main reason for this
   1.299 +// difference is a requirement in the C++ standard: the standard input
   1.300 +// and output streams cin and cout are required by default to be synchronized
   1.301 +// with the C library components stdin and stdout.  This means it must be
   1.302 +// possible to synchronize a basic_streambuf<char> with a C buffer.
   1.303 +//
   1.304 +// There are two basic ways to do that.  First, the streambuf could be
   1.305 +// unbuffered and delegate all buffering to stdio operations.  This
   1.306 +// would be correct, but slow: it would require at least one virtual
   1.307 +// function call for every character.  Second, the streambuf could use 
   1.308 +// a C stdio FILE as its buffer.  
   1.309 +//
   1.310 +// We choose the latter option.  Every streambuf has pointers to two
   1.311 +// FILE objects, one for the get area and one for the put area.  Ordinarily
   1.312 +// it just uses a FILE object as a convenient way to package the three
   1.313 +// get/put area pointers.  If a basic_streambuf<char> is synchronized with
   1.314 +// a stdio stream, though, then the pointers are to a FILE object that's
   1.315 +// also used by the C library.
   1.316 +//
   1.317 +// The header <stl/_stdio_file.h> encapsulates the implementation details
   1.318 +// of struct FILE.  It contains low-level inline functions that convert
   1.319 +// between whe FILE's internal representation and the three-pointer 
   1.320 +// representation that basic_streambuf<> needs.
   1.321 +
   1.322 +_STLP_TEMPLATE_NULL 
   1.323 +#ifdef __SYMBIAN32__
   1.324 +class basic_streambuf<char, char_traits<char> >
   1.325 +#else
   1.326 +class _STLP_CLASS_DECLSPEC basic_streambuf<char, char_traits<char> >
   1.327 +#endif
   1.328 +{
   1.329 +  friend class basic_istream<char, char_traits<char> >;
   1.330 +  friend class basic_ostream<char, char_traits<char> >;
   1.331 +public:                         // Typedefs.
   1.332 +  typedef char                        char_type;
   1.333 +  typedef char_traits<char>::int_type int_type;
   1.334 +  typedef char_traits<char>::pos_type pos_type;
   1.335 +  typedef char_traits<char>::off_type off_type;
   1.336 +  typedef char_traits<char>           traits_type;
   1.337 +
   1.338 +private:                        // Data members.
   1.339 +
   1.340 +  FILE* _M_get;                 // Reference to the get area
   1.341 +  FILE* _M_put;                 // Reference to the put area
   1.342 +
   1.343 +#if defined(__hpux)
   1.344 +  _FILEX  _M_default_get;          // Get area, unless we're syncing with stdio.
   1.345 +  _FILEX  _M_default_put;          // Put area, unless we're syncing with stdio.
   1.346 +#else
   1.347 +  FILE  _M_default_get;          // Get area, unless we're syncing with stdio.
   1.348 +  FILE  _M_default_put;          // Put area, unless we're syncing with stdio.
   1.349 +#endif
   1.350 +
   1.351 +  locale _M_locale;
   1.352 +
   1.353 +public:                         // Extension: locking, for thread safety.
   1.354 +  _STLP_mutex _M_lock;
   1.355 +
   1.356 +public:                         // Destructor.
   1.357 +  _STLP_DECLSPEC virtual ~basic_streambuf _STLP_PSPEC2(char, char_traits<char>) ();
   1.358 +
   1.359 +public:
   1.360 +  // The default constructor; defined here inline as some compilers require it
   1.361 +  _STLP_DECLSPEC basic_streambuf _STLP_PSPEC2(char, char_traits<char>) ();
   1.362 +  // Extension: a constructor for streambufs synchronized with C stdio files.
   1.363 +  _STLP_DECLSPEC basic_streambuf _STLP_PSPEC2(char, char_traits<char>) (FILE* __get, FILE* __put);
   1.364 +
   1.365 +protected:                      // Protected interface to the get area.
   1.366 +  char_type* eback() const { return _FILE_I_begin(_M_get); }
   1.367 +  char_type* gptr()  const { return _FILE_I_next(_M_get); }
   1.368 +  char_type* egptr() const { return _FILE_I_end(_M_get); }
   1.369 +  void gbump(int __n) { _FILE_I_bump(_M_get, __n); }
   1.370 +  void setg(char_type* __gbegin, char_type* __gnext, char_type* __gend)
   1.371 +    { 
   1.372 +    _FILE_I_set(_M_get, __gbegin, __gnext, __gend); 
   1.373 +#ifdef __SYMBIAN32__
   1.374 +    _change_input_mode();
   1.375 +#endif
   1.376 +    }
   1.377 +
   1.378 +public:
   1.379 +  // An alternate public interface to the above functions
   1.380 +  // which allows us to avoid using templated friends which
   1.381 +  // are not supported on some compilers.
   1.382 +
   1.383 +  char_type* _M_eback() const { return _FILE_I_begin(_M_get); }
   1.384 +  char_type* _M_gptr()  const { return _FILE_I_next(_M_get); }
   1.385 +  char_type* _M_egptr() const { return _FILE_I_end(_M_get); }
   1.386 +
   1.387 +  void _M_gbump(int __n) { _FILE_I_bump(_M_get, __n); }
   1.388 +  void _M_setg(char_type* __gbegin, char_type* __gnext, char_type* __gend)
   1.389 +    { _FILE_I_set(_M_get, __gbegin, __gnext, __gend); }
   1.390 +
   1.391 +protected:                      // Protected interface to the put area
   1.392 +  char_type* pbase() const { return _FILE_O_begin(_M_put); }
   1.393 +  char_type* pptr()  const { return _FILE_O_next(_M_put); }
   1.394 +  char_type* epptr() const { return _FILE_O_end(_M_put); }
   1.395 +
   1.396 +  void pbump(int __n) { _FILE_O_bump(_M_put, __n); }
   1.397 +  void setp(char_type* __pbegin, char_type* __pend)
   1.398 +    { _FILE_O_set(_M_put, __pbegin, __pbegin, __pend); }
   1.399 +
   1.400 +protected:                      // Virtual buffer-management functions.
   1.401 +  _STLP_DECLSPEC virtual basic_streambuf<char, char_traits<char> >* setbuf(char_type*, streamsize);
   1.402 +  _STLP_DECLSPEC virtual pos_type seekoff(off_type, ios_base::seekdir,
   1.403 +                           ios_base::openmode = ios_base::in | ios_base::out);
   1.404 +  _STLP_DECLSPEC  virtual pos_type
   1.405 +  seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
   1.406 +  _STLP_DECLSPEC virtual int sync();
   1.407 +
   1.408 +public:                         // Buffer management.
   1.409 +  basic_streambuf<char, char_traits<char> >* pubsetbuf(char_type* __s, streamsize __n) 
   1.410 +    { return this->setbuf(__s, __n); }
   1.411 +
   1.412 +  pos_type pubseekoff(off_type __offset, ios_base::seekdir __way,
   1.413 +                      ios_base::openmode __mod = ios_base::in | ios_base::out)
   1.414 +    { return this->seekoff(__offset, __way, __mod); }
   1.415 +
   1.416 +  pos_type pubseekpos(pos_type __sp,
   1.417 +                      ios_base::openmode __mod = ios_base::in | ios_base::out)
   1.418 +    { return this->seekpos(__sp, __mod); }
   1.419 +
   1.420 +  int pubsync() { return this->sync(); }
   1.421 +
   1.422 +protected:                      // Virtual get area functions.
   1.423 +  _STLP_DECLSPEC virtual streamsize showmanyc();
   1.424 +  _STLP_DECLSPEC virtual streamsize xsgetn(char_type* __s, streamsize __n);
   1.425 +  _STLP_DECLSPEC virtual int_type underflow();
   1.426 +  _STLP_DECLSPEC virtual int_type uflow();
   1.427 +  _STLP_DECLSPEC virtual int_type pbackfail(int_type __c = traits_type::eof());
   1.428 +
   1.429 +protected:                      // Virtual put area functions.
   1.430 +  _STLP_DECLSPEC virtual streamsize xsputn(const char_type* __s, streamsize __n);
   1.431 +  _STLP_DECLSPEC virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
   1.432 +  _STLP_DECLSPEC virtual int_type overflow(int_type = traits_type::eof());
   1.433 +#ifdef __SYMBIAN32__  
   1.434 +  virtual int save_read_buffer () { return 0; }
   1.435 +  virtual void _change_input_mode() {};
   1.436 +#endif
   1.437 +public:                         // Public members for writing characters.
   1.438 +  // Write a single character.
   1.439 +  int_type sputc(char_type __c) {
   1.440 +    int_type __res;
   1.441 +	if( _FILE_O_avail(_M_put) > 0 )
   1.442 +	{
   1.443 +		_FILE_O_postincr(_M_put) = __c;
   1.444 +		__res = traits_type::to_int_type(__c);
   1.445 +	}
   1.446 +	else
   1.447 +      __res = this->overflow(traits_type::to_int_type(__c));
   1.448 +    return __res;
   1.449 +  }
   1.450 +
   1.451 +  // Write __n characters.
   1.452 +  streamsize sputn(const char_type* __s, streamsize __n)
   1.453 +    { return this->xsputn(__s, __n); }
   1.454 +
   1.455 +  // Extension: write __n copies of __c.
   1.456 +  streamsize _M_sputnc(char_type __c, streamsize __n)
   1.457 +    { return this->_M_xsputnc(__c, __n); }
   1.458 +
   1.459 +private:                        // Helper functions.
   1.460 +  _STLP_DECLSPEC int_type _M_snextc_aux();
   1.461 +
   1.462 +public:                         // Public members for reading characters.
   1.463 +  streamsize in_avail()
   1.464 +    { return _FILE_I_avail(_M_get) > 0 ? _FILE_I_avail(_M_get)
   1.465 +#ifdef __SYMBIAN32__  
   1.466 +                                     + save_read_buffer()
   1.467 +#endif
   1.468 +                                     : this->showmanyc(); }
   1.469 +  
   1.470 +  // Advance to the next character and return it.
   1.471 +  int_type snextc() {
   1.472 +    return _FILE_I_avail(_M_get) > 1
   1.473 +      ? traits_type::to_int_type(_FILE_I_preincr(_M_get))
   1.474 +      : this->_M_snextc_aux();
   1.475 +  }
   1.476 +
   1.477 +  // Return the current character and advance to the next.
   1.478 +  int_type sbumpc() {
   1.479 +    return _FILE_I_avail(_M_get) > 0
   1.480 +      ? traits_type::to_int_type(_FILE_I_postincr(_M_get))
   1.481 +      : this->uflow();
   1.482 +  }
   1.483 +
   1.484 +  // Return the current character without advancing to the next.
   1.485 +  int_type sgetc() {
   1.486 +    return _FILE_I_avail(_M_get) > 0
   1.487 +      ? traits_type::to_int_type(*_FILE_I_next(_M_get))
   1.488 +      : this->underflow();
   1.489 +  }
   1.490 +    
   1.491 +  streamsize sgetn(char_type* __s, streamsize __n)
   1.492 +    { return this->xsgetn(__s, __n); }
   1.493 +
   1.494 +  int_type sputbackc(char_type __c) {
   1.495 +    return _FILE_I_begin(_M_get) < _FILE_I_next(_M_get) &&
   1.496 +           __c == *(_FILE_I_next(_M_get) - 1)
   1.497 +      ? traits_type::to_int_type(_FILE_I_predecr(_M_get))
   1.498 +      : this->pbackfail(traits_type::to_int_type(__c));
   1.499 +  }
   1.500 +
   1.501 +  int_type sungetc() {
   1.502 +    return _FILE_I_begin(_M_get) < _FILE_I_next(_M_get)
   1.503 +      ? traits_type::to_int_type(_FILE_I_predecr(_M_get))
   1.504 +      : this->pbackfail();
   1.505 +  }
   1.506 +
   1.507 +protected:                      // Virtual locale functions.
   1.508 +  _STLP_DECLSPEC virtual void imbue(const locale&);
   1.509 +public:                         // Locale-related functions.
   1.510 +  _STLP_DECLSPEC locale pubimbue(const locale&);
   1.511 +  locale getloc() const { return _M_locale; }
   1.512 +
   1.513 +# ifndef _STLP_NO_ANACHRONISMS
   1.514 +public:
   1.515 +  void stossc() { this->sbumpc(); }
   1.516 +# endif
   1.517 +
   1.518 +#if defined(__MVS__) || defined(__OS400__)
   1.519 +private: // Data members.
   1.520 +
   1.521 +  char_type* _M_gbegin; // Beginning of get area
   1.522 +  char_type* _M_gnext; // Current position within the get area
   1.523 +  char_type* _M_gend; // End of get area
   1.524 +
   1.525 +  char_type* _M_pbegin; // Beginning of put area
   1.526 +  char_type* _M_pnext; // Current position within the put area
   1.527 +  char_type* _M_pend; // End of put area
   1.528 +#endif
   1.529 +
   1.530 +};
   1.531 +_STLP_END_NAMESPACE
   1.532 +
   1.533 +# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
   1.534 +#  include <stl/_streambuf.c>
   1.535 +# endif
   1.536 +
   1.537 +#endif
   1.538 +// Local Variables:
   1.539 +// mode:C++
   1.540 +// End: