1 #ifndef fixedstreambuf_h 2 #define fixedstreambuf_h 52 setg( buf_, buf_, buf_ + sz_ );
53 setp( buf_, buf_ + sz_ );
58 virtual pos_type
seekoff( off_type offs, ios_base::seekdir sd,
59 ios_base::openmode which )
62 if ( sd == ios_base::cur )
63 newpos_ += which == ios_base::in ? gptr() - buf_ : pptr() - buf_;
64 else if ( sd == ios_base::end )
65 newpos_ = sz_ + newpos_;
67 return seekpos( newpos_, which );
70 virtual pos_type
seekpos( pos_type newpos, ios_base::openmode which )
72 if ( newpos_ < 0 || newpos_ >= sz_ )
74 else if ( which == ios_base::in )
75 setg( buf_, buf_+newpos_, buf_ + sz_ );
77 setp( buf_+newpos_, buf_ + sz_ );
82 virtual streamsize
xsgetn( char_type* s, streamsize n )
85 const od_int64 memsz = epptr() - pptr();
86 if ( toget > memsz && memsz >= 0 )
89 OD::memCopy( s, gptr(), (
size_t)toget );
95 virtual streamsize
xsputn(
const char_type* s, streamsize n )
98 const od_int64 memsz = epptr() - pptr();
99 if ( toput > memsz && memsz >= 0 )
102 OD::memCopy( pptr(), s, (
size_t)toput );
~fixedstreambuf()
Definition: fixedstreambuf.h:43
virtual fixedstreambuf * setbuf(char_type *b, streamsize n)
Definition: fixedstreambuf.h:49
Definition: fixedstreambuf.h:114
off_type sz_
Definition: fixedstreambuf.h:109
#define od_int64
Definition: plftypes.h:34
char_type * buf_
Definition: fixedstreambuf.h:108
virtual pos_type seekoff(off_type offs, ios_base::seekdir sd, ios_base::openmode which)
Definition: fixedstreambuf.h:58
Definition: fixedstreambuf.h:18
~fixedistream()
Definition: fixedstreambuf.h:122
~fixedostream()
Definition: fixedstreambuf.h:135
virtual streamsize xsgetn(char_type *s, streamsize n)
Definition: fixedstreambuf.h:82
fixedostream(fixedstreambuf *sb)
Definition: fixedstreambuf.h:131
fixedstreambuf(char_type *b, off_type sz, bool manbuf=false)
Definition: fixedstreambuf.h:36
fixedistream(fixedstreambuf *sb)
Definition: fixedstreambuf.h:118
bool mine_
Definition: fixedstreambuf.h:110
Adapter to use a fixed buffer as a stream.
Definition: fixedstreambuf.h:32
Definition: fixedstreambuf.h:127
#define mClass(module)
Definition: commondefs.h:161
virtual streamsize xsputn(const char_type *s, streamsize n)
Definition: fixedstreambuf.h:95
off_type newpos_
Definition: fixedstreambuf.h:111
virtual pos_type seekpos(pos_type newpos, ios_base::openmode which)
Definition: fixedstreambuf.h:70