ossrv_pub/io_stream_api/inc/stdapis/stlport/stl/_streambuf.h
changeset 22 ddc455616bd6
parent 0 e4d67989cc36
child 45 4b03adbd26ca
child 57 2efc27d87e1c
equal deleted inserted replaced
18:47c74d1534e1 22:ddc455616bd6
    83 
    83 
    84 public:                         // Extension: locking, for thread safety.
    84 public:                         // Extension: locking, for thread safety.
    85   _STLP_mutex _M_lock;
    85   _STLP_mutex _M_lock;
    86 
    86 
    87 public:                         // Destructor.
    87 public:                         // Destructor.
    88   _STLP_DECLSPEC virtual ~basic_streambuf();
    88   _STLP_DUMMY_IMP_DECLSPEC virtual ~basic_streambuf();
    89 
    89 
    90 protected:                      // The default constructor.
    90 protected:                      // The default constructor.
    91   _STLP_DECLSPEC basic_streambuf();
    91   _STLP_DUMMY_IMP_DECLSPEC basic_streambuf();
    92 
    92 
    93 protected:                      // Protected interface to the get area.
    93 protected:                      // Protected interface to the get area.
    94   char_type* eback() const { return _M_gbegin; } // Beginning
    94   char_type* eback() const { return _M_gbegin; } // Beginning
    95   char_type* gptr()  const { return _M_gnext; }  // Current position
    95   char_type* gptr()  const { return _M_gnext; }  // Current position
    96   char_type* egptr() const { return _M_gend; }   // End
    96   char_type* egptr() const { return _M_gend; }   // End
   127     _M_pend   = __pend;
   127     _M_pend   = __pend;
   128   }
   128   }
   129 
   129 
   130 protected:                      // Virtual buffer management functions.
   130 protected:                      // Virtual buffer management functions.
   131 
   131 
   132   _STLP_DECLSPEC virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
   132   _STLP_DUMMY_IMP_DECLSPEC virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
   133 
   133 
   134   // Alters the stream position, using an integer offset.  In this
   134   // Alters the stream position, using an integer offset.  In this
   135   // class seekoff does nothing; subclasses are expected to override it.
   135   // class seekoff does nothing; subclasses are expected to override it.
   136   _STLP_DECLSPEC virtual pos_type seekoff(off_type, ios_base::seekdir,
   136   _STLP_DUMMY_IMP_DECLSPEC virtual pos_type seekoff(off_type, ios_base::seekdir,
   137                            ios_base::openmode = ios_base::in | ios_base::out);
   137                            ios_base::openmode = ios_base::in | ios_base::out);
   138 
   138 
   139   // Alters the stream position, using a previously obtained streampos.  In
   139   // Alters the stream position, using a previously obtained streampos.  In
   140   // this class seekpos does nothing; subclasses are expected to override it.
   140   // this class seekpos does nothing; subclasses are expected to override it.
   141   _STLP_DECLSPEC virtual pos_type
   141   _STLP_DUMMY_IMP_DECLSPEC virtual pos_type
   142   seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
   142   seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
   143 
   143 
   144   // Synchronizes (i.e. flushes) the buffer.  All subclasses are expected to 
   144   // Synchronizes (i.e. flushes) the buffer.  All subclasses are expected to 
   145   // override this virtual member function.
   145   // override this virtual member function.
   146   _STLP_DECLSPEC virtual int sync();
   146   _STLP_DUMMY_IMP_DECLSPEC virtual int sync();
   147 
   147 
   148 
   148 
   149 public:                         // Buffer management.
   149 public:                         // Buffer management.
   150   basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n) 
   150   basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n) 
   151     { return this->setbuf(__s, __n); }
   151     { return this->setbuf(__s, __n); }
   164                                 // 17.5.2.4.3 and 17.5.2.4.4 of the standard.
   164                                 // 17.5.2.4.3 and 17.5.2.4.4 of the standard.
   165   // Returns a lower bound on the number of characters that we can read,
   165   // Returns a lower bound on the number of characters that we can read,
   166   // with underflow, before reaching end of file.  (-1 is a special value:
   166   // with underflow, before reaching end of file.  (-1 is a special value:
   167   // it means that underflow will fail.)  Most subclasses should probably
   167   // it means that underflow will fail.)  Most subclasses should probably
   168   // override this virtual member function.
   168   // override this virtual member function.
   169   _STLP_DECLSPEC virtual streamsize showmanyc();
   169   _STLP_DUMMY_IMP_DECLSPEC virtual streamsize showmanyc();
   170 
   170 
   171   // Reads up to __n characters.  Return value is the number of 
   171   // Reads up to __n characters.  Return value is the number of 
   172   // characters read.
   172   // characters read.
   173   _STLP_DECLSPEC virtual streamsize xsgetn(char_type* __s, streamsize __n);
   173   _STLP_DUMMY_IMP_DECLSPEC virtual streamsize xsgetn(char_type* __s, streamsize __n);
   174 
   174 
   175   // Called when there is no read position, i.e. when gptr() is null
   175   // Called when there is no read position, i.e. when gptr() is null
   176   // or when gptr() >= egptr().  Subclasses are expected to override
   176   // or when gptr() >= egptr().  Subclasses are expected to override
   177   // this virtual member function.
   177   // this virtual member function.
   178   _STLP_DECLSPEC virtual int_type underflow();
   178   _STLP_DUMMY_IMP_DECLSPEC virtual int_type underflow();
   179 
   179 
   180   // Similar to underflow(), but used for unbuffered input.  Most 
   180   // Similar to underflow(), but used for unbuffered input.  Most 
   181   // subclasses should probably override this virtual member function.
   181   // subclasses should probably override this virtual member function.
   182   _STLP_DECLSPEC virtual int_type uflow();
   182   _STLP_DUMMY_IMP_DECLSPEC virtual int_type uflow();
   183 
   183 
   184   // Called when there is no putback position, i.e. when gptr() is null
   184   // Called when there is no putback position, i.e. when gptr() is null
   185   // or when gptr() == eback().  All subclasses are expected to override
   185   // or when gptr() == eback().  All subclasses are expected to override
   186   // this virtual member function.
   186   // this virtual member function.
   187   _STLP_DECLSPEC virtual int_type pbackfail(int_type = traits_type::eof());
   187   _STLP_DUMMY_IMP_DECLSPEC virtual int_type pbackfail(int_type = traits_type::eof());
   188 
   188 
   189 protected:                      // Virtual put area functions, as defined in
   189 protected:                      // Virtual put area functions, as defined in
   190                                 // 27.5.2.4.5 of the standard.
   190                                 // 27.5.2.4.5 of the standard.
   191 
   191 
   192   // Writes up to __n characters.  Return value is the number of characters
   192   // Writes up to __n characters.  Return value is the number of characters
   193   // written.
   193   // written.
   194   _STLP_DECLSPEC virtual streamsize xsputn(const char_type* __s, streamsize __n);
   194   _STLP_DUMMY_IMP_DECLSPEC virtual streamsize xsputn(const char_type* __s, streamsize __n);
   195 
   195 
   196   // Extension: writes up to __n copies of __c.  Return value is the number
   196   // Extension: writes up to __n copies of __c.  Return value is the number
   197   // of characters written.
   197   // of characters written.
   198   _STLP_DECLSPEC virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
   198   _STLP_DUMMY_IMP_DECLSPEC virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
   199 
   199 
   200   // Called when there is no write position.  All subclasses are expected to
   200   // Called when there is no write position.  All subclasses are expected to
   201   // override this virtual member function.
   201   // override this virtual member function.
   202   _STLP_DECLSPEC virtual int_type overflow(int_type = traits_type::eof());
   202   _STLP_DUMMY_IMP_DECLSPEC virtual int_type overflow(int_type = traits_type::eof());
   203 
   203 
   204 public:                         // Public members for writing characters.
   204 public:                         // Public members for writing characters.
   205   // Write a single character.
   205   // Write a single character.
   206   int_type sputc(char_type __c) {
   206   int_type sputc(char_type __c) {
   207     return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c)
   207     return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c)
   215   // Extension: write __n copies of __c.
   215   // Extension: write __n copies of __c.
   216   streamsize _M_sputnc(char_type __c, streamsize __n)
   216   streamsize _M_sputnc(char_type __c, streamsize __n)
   217     { return this->_M_xsputnc(__c, __n); }
   217     { return this->_M_xsputnc(__c, __n); }
   218 
   218 
   219 private:                        // Helper functions.
   219 private:                        // Helper functions.
   220   _STLP_DECLSPEC int_type _M_snextc_aux();
   220   _STLP_DUMMY_IMP_DECLSPEC int_type _M_snextc_aux();
   221 
   221 
   222 
   222 
   223 public:                         // Public members for reading characters.
   223 public:                         // Public members for reading characters.
   224   streamsize in_avail() {
   224   streamsize in_avail() {
   225     return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc();
   225     return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc();
   263 
   263 
   264   // This is a hook, called by pubimbue() just before pubimbue()
   264   // This is a hook, called by pubimbue() just before pubimbue()
   265   // sets the streambuf's locale to __loc.  Note that imbue should
   265   // sets the streambuf's locale to __loc.  Note that imbue should
   266   // not (and cannot, since it has no access to streambuf's private
   266   // not (and cannot, since it has no access to streambuf's private
   267   // members) set the streambuf's locale itself.
   267   // members) set the streambuf's locale itself.
   268   _STLP_DECLSPEC virtual void imbue(const locale&);
   268   _STLP_DUMMY_IMP_DECLSPEC virtual void imbue(const locale&);
   269 
   269 
   270 public:                         // Locale-related functions.
   270 public:                         // Locale-related functions.
   271   _STLP_DECLSPEC locale pubimbue(const locale&);
   271   _STLP_DUMMY_IMP_DECLSPEC locale pubimbue(const locale&);
   272   locale getloc() const { return _M_locale; }
   272   locale getloc() const { return _M_locale; }
   273 
   273 
   274 # ifndef _STLP_NO_ANACHRONISMS
   274 # ifndef _STLP_NO_ANACHRONISMS
   275   void stossc() { this->sbumpc(); }
   275   void stossc() { this->sbumpc(); }
   276 # endif
   276 # endif