Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

WordWrapStreamBuf Class Reference

Used by WordWrapStream to implement an ostream that flushes its output to ProgramBase::show_text(). More...

#include <wordWrapStreamBuf.h>

List of all members.

Public Member Functions

 WordWrapStreamBuf (WordWrapStream *owner, ProgramBase *program)
virtual ~WordWrapStreamBuf ()

Protected Member Functions

virtual int overflow (int c)
 Called by the system ostream implementation when its internal buffer is filled, plus one character.

virtual int sync ()
 Called by the system ostream implementation when the buffer should be flushed to output (for instance, on destruction).


Private Member Functions

void write_chars (const char *start, int length)
 An internal function called by sync() and overflow() to store one or more characters written to the stream into the memory buffer.

void set_literal_mode (bool mode)
 An internal function called to update the internal state according to the current value of the Notify::literal flag, which might or might not be set of the ostream at any time.

void flush_data ()
 Writes the contents of _data to the actual output stream, either word-wrapped or not as appropriate, and empties the contents of _data.


Private Attributes

string _data
WordWrapStream_owner
ProgramBase_program
bool _literal_mode


Detailed Description

Used by WordWrapStream to implement an ostream that flushes its output to ProgramBase::show_text().

Definition at line 41 of file wordWrapStreamBuf.h.


Constructor & Destructor Documentation

WordWrapStreamBuf::WordWrapStreamBuf WordWrapStream owner,
ProgramBase program
 

Definition at line 41 of file wordWrapStreamBuf.cxx.

WordWrapStreamBuf::~WordWrapStreamBuf  )  [virtual]
 

Definition at line 56 of file wordWrapStreamBuf.cxx.

References flush_data(), streamsize, and write_chars().


Member Function Documentation

void WordWrapStreamBuf::flush_data  )  [private]
 

Writes the contents of _data to the actual output stream, either word-wrapped or not as appropriate, and empties the contents of _data.

Definition at line 156 of file wordWrapStreamBuf.cxx.

Referenced by overflow(), and ~WordWrapStreamBuf().

int WordWrapStreamBuf::overflow int  c  )  [protected, virtual]
 

Called by the system ostream implementation when its internal buffer is filled, plus one character.

Definition at line 94 of file wordWrapStreamBuf.cxx.

References _data, _owner, flush_data(), Notify::get_literal_flag(), length, set_literal_mode(), and size_t.

void WordWrapStreamBuf::set_literal_mode bool  mode  )  [inline, private]
 

An internal function called to update the internal state according to the current value of the Notify::literal flag, which might or might not be set of the ostream at any time.

When the literal flag is true, we should not word-wrap, so toggling this flag means we need to flush the current buffer.

Definition at line 42 of file wordWrapStreamBuf.I.

Referenced by overflow().

int WordWrapStreamBuf::sync void   )  [protected, virtual]
 

Called by the system ostream implementation when the buffer should be flushed to output (for instance, on destruction).

Definition at line 73 of file wordWrapStreamBuf.cxx.

References streamsize, and write_chars().

void WordWrapStreamBuf::write_chars const char *  start,
int  length
[private]
 

An internal function called by sync() and overflow() to store one or more characters written to the stream into the memory buffer.

Definition at line 124 of file wordWrapStreamBuf.cxx.

References _data, _program, and ProgramBase::show_text().

Referenced by sync(), and ~WordWrapStreamBuf().


Member Data Documentation

string WordWrapStreamBuf::_data [private]
 

Definition at line 55 of file wordWrapStreamBuf.h.

Referenced by overflow(), and write_chars().

bool WordWrapStreamBuf::_literal_mode [private]
 

Definition at line 58 of file wordWrapStreamBuf.h.

WordWrapStream* WordWrapStreamBuf::_owner [private]
 

Definition at line 56 of file wordWrapStreamBuf.h.

Referenced by overflow().

ProgramBase* WordWrapStreamBuf::_program [private]
 

Definition at line 57 of file wordWrapStreamBuf.h.

Referenced by write_chars().


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:28:08 2003 for Panda-Tool by doxygen1.3