1 #ifndef fixedstreambuf_h 2 #define fixedstreambuf_h 51 setg( buf_, buf_, buf_ + sz_ );
52 setp( buf_, buf_ + sz_ );
57 virtual pos_type
seekoff( off_type offs, ios_base::seekdir sd,
58 ios_base::openmode which )
61 if ( sd == ios_base::cur )
62 newpos_ += which == ios_base::in ? gptr() - buf_ : pptr() - buf_;
63 else if ( sd == ios_base::end )
64 newpos_ = sz_ + newpos_;
66 return seekpos( newpos_, which );
69 virtual pos_type
seekpos( pos_type newpos, ios_base::openmode which )
71 if ( newpos_ < 0 || newpos_ >= sz_ )
73 else if ( which == ios_base::in )
74 setg( buf_, buf_+newpos_, buf_ + sz_ );
76 setp( buf_+newpos_, buf_ + sz_ );
81 virtual streamsize
xsgetn( char_type* s, streamsize n )
84 const od_int64 memsz = epptr() - pptr();
85 if ( toget > memsz && memsz >= 0 )
88 OD::memCopy( s, gptr(), (
size_t)toget );
94 virtual streamsize
xsputn(
const char_type* s, streamsize n )
97 const od_int64 memsz = epptr() - pptr();
98 if ( toput > memsz && memsz >= 0 )
101 OD::memCopy( pptr(), s, (
size_t)toput );
~fixedstreambuf()
Definition: fixedstreambuf.h:42
virtual fixedstreambuf * setbuf(char_type *b, streamsize n)
Definition: fixedstreambuf.h:48
off_type sz_
Definition: fixedstreambuf.h:108
#define od_int64
Definition: plftypes.h:36
char_type * buf_
Definition: fixedstreambuf.h:107
virtual pos_type seekoff(off_type offs, ios_base::seekdir sd, ios_base::openmode which)
Definition: fixedstreambuf.h:57
Definition: fixedstreambuf.h:17
virtual streamsize xsgetn(char_type *s, streamsize n)
Definition: fixedstreambuf.h:81
fixedstreambuf(char_type *b, off_type sz, bool manbuf=false)
Definition: fixedstreambuf.h:35
bool mine_
Definition: fixedstreambuf.h:109
Adapter to use a fixed buffer as a stream.
Definition: fixedstreambuf.h:31
#define mClass(module)
Definition: commondefs.h:164
virtual streamsize xsputn(const char_type *s, streamsize n)
Definition: fixedstreambuf.h:94
off_type newpos_
Definition: fixedstreambuf.h:110
virtual pos_type seekpos(pos_type newpos, ios_base::openmode which)
Definition: fixedstreambuf.h:69