105 int_type
overflow( int_type c = traits_type::eof() )
override {
106 int_type ret = traits_type::eof();
108 if ( ! traits_type::eq_int_type( c, traits_type::eof() ) )
110 *pptr() = traits_type::to_char_type( c );
113 if ( pbase() <= pptr() )
115 if ( this->
writeData( pbase(), pptr() - pbase() ) )
118 ret = traits_type::not_eof( c );
154 pos_type
seekoff( off_type off_r, std::ios_base::seekdir way_r, std::ios_base::openmode openMode )
override {
155 pos_type ret = pos_type(off_type(-1));
160 if ( openMode == std::ios_base::out ) {
165 ret = this->
seekTo( off_r, way_r, openMode );
167 }
else if ( openMode == std::ios_base::in ) {
172 const off_type buffEndOff = this->
tell();
174 if ( buffEndOff != off_type(-1) ) {
175 if ( way_r == std::ios_base::end ) {
177 ret = this->
seekTo( off_r, way_r, openMode );
180 const off_type bufLen = egptr() - eback();
181 const off_type bufStartFileOff = buffEndOff - bufLen;
182 const off_type currPtrFileOffset = buffEndOff - ( egptr() - gptr() );
183 off_type newFOff = off_r;
186 if ( way_r == std::ios_base::cur ) {
187 newFOff += currPtrFileOffset;
188 way_r = std::ios_base::beg;
192 if ( way_r == std::ios_base::beg ) {
193 if ( bufStartFileOff <= newFOff && newFOff <= buffEndOff ) {
197 eback() + ( newFOff - bufStartFileOff ),
199 ret = pos_type( newFOff );
203 ret = this->
seekTo( off_r, way_r, openMode );