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