All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_StringRefStreamBuffer Class Reference

#include <UT_StringStream.h>

+ Inheritance diagram for UT_StringRefStreamBuffer:

Public Member Functions

 UT_StringRefStreamBuffer (UT_WorkBuffer &buf, openmode mode=in_out)
const UT_WorkBufferstr () const
 Returns a read-only reference to the underlying storage. More...
- Public Member Functions inherited from UT_StringStreamBufferBase< UT_StringRefStreamBuffer >
virtual ~UT_StringStreamBufferBase ()
void reset ()

Protected Member Functions

virtual int sync ()
 std::streambuf helpers. More...
UT_WorkBufferbuffer ()
const UT_WorkBufferbuffer () const
- Protected Member Functions inherited from UT_StringStreamBufferBase< UT_StringRefStreamBuffer >
 UT_StringStreamBufferBase (openmode mode)
void init (bool use_existing=false)
const UT_WorkBufferstr () const
void updateBufferEnd ()
virtual pos_type seekoff (off_type offset, std::ios_base::seekdir dir, openmode mode=in_out)
virtual pos_type seekpos (pos_type pos, std::ios_base::openmode mode=in_out)
virtual int_type underflow ()
virtual streamsize xsgetn (char_type *dst, streamsize num)
virtual streamsize showmanyc ()
virtual int_type overflow (int_type c)
virtual streamsize xsputn (const char_type *src, streamsize num)
openmode mode () const
void pbump64 (exint offset)
void gbump64 (exint offset)

Static Protected Member Functions

static bool autoTerminate ()


class UT_StringStreamBufferBase< UT_StringRefStreamBuffer >

Additional Inherited Members

- Public Types inherited from UT_StringStreamBufferBase< UT_StringRefStreamBuffer >
typedef std::ios_base::openmode openmode
typedef std::streamsize streamsize

Detailed Description

====================================================================== A version of std::streambuf which holds a reference to an external UT_WorkBuffer object. It is important that the life cycle of the external UT_WorkBuffer fully encloses the life cycle of the UT_StringRefStreamBuffer object. Upon destruction of the UT_StringRefStreamBuffer object the UT_WorkBuffer object will be guaranteed to be null terminated. While the UT_StringRefStream is live, no such guarantee is made. To force a null termination, call UT_StringRefStream::sync(). If the external buffer is changed outside of the stream object, then it is necessary to call UT_StringRefStream::sync() so that any references to the buffer can be updated. In this case, an output stream will be reset to the end of the buffer. The input stream is left to point to the same location, unless it now points beyond the end, in which case it gets marked as eof. Note that there is a difference between ref-buffer and non-ref-buffer when writing data after seeking back in the stream. Because the ref-buffer auto terminates after the newly written characters, it may terminate the string before the end of previously written characters, effectively discarding these older characters.

Definition at line 358 of file UT_StringStream.h.

Constructor & Destructor Documentation

UT_StringRefStreamBuffer::UT_StringRefStreamBuffer ( UT_WorkBuffer buf,
openmode  mode = in_out 

Take a reference to an existing UT_WorkBuffer. The output position set to the end of the buffer, and the input position at the beginning of the buffer.

Definition at line 366 of file UT_StringStream.h.

Member Function Documentation

static bool UT_StringRefStreamBuffer::autoTerminate ( )

Definition at line 384 of file UT_StringStream.h.

UT_WorkBuffer& UT_StringRefStreamBuffer::buffer ( )

Definition at line 382 of file UT_StringStream.h.

const UT_WorkBuffer& UT_StringRefStreamBuffer::buffer ( ) const

Definition at line 383 of file UT_StringStream.h.

const UT_WorkBuffer& UT_StringRefStreamBuffer::str ( ) const

Returns a read-only reference to the underlying storage.

Definition at line 375 of file UT_StringStream.h.

int UT_StringRefStreamBuffer::sync ( )

std::streambuf helpers.

Definition at line 453 of file UT_StringStreamImpl.h.

Friends And Related Function Documentation

Definition at line 381 of file UT_StringStream.h.

The documentation for this class was generated from the following files: