- virtual Parent * setbuf (char_type *, std::streamsize)
- Sets or resets channelbuf internal buffer.
- virtual int sync ()
- Synchronizes (i.e.
- virtual int_type overflow (int_type=traits_type::eof())
- Called every time there is no enough space in the internal buffer.
Private Attributes
Detailed Description Simple formatting std::streambuf. This is a core class of DGD. Here actual output formatting takes place. Please refer to DGD::channel for general explanation on the channel formatting capabilities. The discussion below is focused on technical aspects of the formatting. DGD::channelbuf has it's own memory buffer which can be controlled by channelbuf::setbuf(char_type*,std::streamsize) method. All channel input (see DGD::channel for the terminology) formatted by std::ostream operators is put into it. DGD::channelbuf scans the buffer (see channelbuf::overflow(int_type)) and makes the additional formatting. DGD::channelbuf acts as a stream multiplexor. It maintains a list of DGD::stream objects which are "associated" with this channel buffer (see channelbuf::assoc(std::ostream*)). If the list is empty no output is produced. The channelbuf output is copied to all objects on the list when it is ready. std::ostream object can be associated with DGD::channelbuf by calling channelbuf::assoc(std::ostream*) method, but it is more appropriate to use DGD::assoc(std::ostream*,channel&) or assoc(std::ostream*,const std::string&) functions. Since channelbuf usually can't figure out whether its input contains a complete line or only part of it, channelbuf does not flush the entire buffer, but only part of it. To keep track of current state of the output it has m_line and m_column variables which can be queried using channelbuf::position() method.
Member Typedef Documentation typedef std::streambuf DGD::channelbuf::Parent |
|
typedef std::pair<unsigned,unsigned> DGD::channelbuf::position_type |
|
typedef std::list< std::ostream* > DGD::channelbuf::Assoc_list [protected] |
|
Member Enumeration Documentation enum DGD::channelbuf::Assoc_type |
|
| - Enumeration values:
Assoc_Append | | Assoc_Assign | | Assoc_Prepend | |
|
enum DGD::channelbuf::DefaultValues |
|
| - Enumeration values:
DefaultBufferSize | | DefaultMaxWidth | | DefaultMinWidth | | DefaultIndentStep | |
|
Constructor & Destructor Documentation DGD::channelbuf::channelbuf | ( | | ) | |
|
DGD::channelbuf::~channelbuf | ( | | ) | |
|
| Destructor. Note that channelbuf tries to sync itself before being destructed. |
Member Function Documentationchannelbuf::Parent * DGD::channelbuf::setbuf | ( | char_type * | ptr, | | | std::streamsize | size | | ) | [protected, virtual] |
|
| Sets or resets channelbuf internal buffer. - Parameters:
ptr | - if NULL causes automatic buffer allocation. | size | - if zero DefaultBufferSize is used. Otherwise defines the allocated buffer size. |
|
int DGD::channelbuf::sync | ( | | ) | [protected, virtual] |
|
| Synchronizes (i.e. flushes) the buffer. - Returns:
- always 0
|
channelbuf::int_type DGD::channelbuf::overflow | ( | int_type | ch = traits_type::eof() | ) | [protected, virtual] |
|
| Called every time there is no enough space in the internal buffer. This function overrides the same function in std::streambuf. Once called, this function processes the content of the buffer, makes formatting decisions and then propagates the formatted output to associated streams. - Parameters:
ch | - character which failed to be pushed into stream. could be set to char_traits::eof value to indicate empty value. |
- Returns:
- always 0
- See also:
- DGD::channel
|
void DGD::channelbuf::propagate | ( | const char_type * | begin, | | | const char_type * | end | | ) | [protected, virtual] |
|
| Propagate character string to associated streams. - Parameters:
begin | - pointer to beginning of propagated string | end | - pointer to the end of the propagated string (one character after the end!) |
|
void DGD::channelbuf::propagate | ( | const char_type | ch, | | | std::streamsize | size | | ) | [protected, virtual] |
|
| Propagate given character to associated streams. - Parameters:
ch | - character to propagate | size | - number of duplications. |
|
void DGD::channelbuf::post_process | ( | | ) | [protected, virtual] |
|
| This is a virtual callback. This function is called every time overflow() or sync() finished their work, so the channelbuf is in consistent state. Subclasses can overload this function in order to add functionality. - See also:
- overflow()
sync()
Reimplemented in DGD::funnelbuf. |
void DGD::channelbuf::assoc | ( | std::ostream * | dgs, | | | const Assoc_type | action = Assoc_Append | | ) | |
|
| Append the given stream to the association list. - Parameters:
dgs | - pointer to the physical stream. | action | - affects the operation performed with the association list. Assoc_Assign will clear the list before appending, Assoc_Append and Assoc_Prepend will put the pointer at the end or at the beginning of the list. |
- See also:
- DGD::channel
|
bool DGD::channelbuf::dassoc | ( | std::ostream * | dgs | ) | |
|
| Remove the specified stream from the association list. If there is a number of same pointers on the list dassoc(std::ostream*) must be called again. - See also:
- assoc(std::ostream*)
dassoc()
|
void DGD::channelbuf::dassoc | ( | | ) | |
|
unsigned int DGD::channelbuf::line | ( | | ) | const |
|
| Return current channel line. |
unsigned int DGD::channelbuf::column | ( | | ) | const |
|
| Return current channel column. |
void DGD::channelbuf::indent_step | ( | unsigned int | step | ) | |
|
unsigned int DGD::channelbuf::indent_step | ( | | ) | const |
|
void DGD::channelbuf::incr_indent | ( | | ) | |
|
| Increment indentation level by value of indentation step. - Note:
- sync() is called before the value is actually changed. So this operation affects only future input.
- See also:
- channel::incr_indent()
|
void DGD::channelbuf::decr_indent | ( | | ) | |
|
| Decrement indentation level by value of indentation step. - Note:
- sync() is called before the value is actually changed. So this operation affects only future input.
- See also:
- channel::decr::indent()
|
void DGD::channelbuf::indent | ( | const unsigned int | val | ) | |
|
unsigned int DGD::channelbuf::indent | ( | | ) | const |
|
void DGD::channelbuf::min_width | ( | unsigned int | width | ) | |
|
unsigned int DGD::channelbuf::min_width | ( | | ) | const |
|
void DGD::channelbuf::max_width | ( | unsigned int | width | ) | |
|
unsigned int DGD::channelbuf::max_width | ( | | ) | const |
|
void DGD::channelbuf::wrap | ( | bool | allow | ) | |
|
| Set character wrapping. - Note:
- sync() is called before the value is actually changed. So this operation affects only future input.
- See also:
- channel::wrap(bool)
|
bool DGD::channelbuf::wrap | ( | | ) | const |
|
void DGD::channelbuf::word_wrap | ( | bool | allow | ) | |
|
| Set word wrapping. - Note:
- sync() is called before the value is actually changed. So this operation affects only future input.
- See also:
- channel::word_wrap(bool)
|
bool DGD::channelbuf::word_wrap | ( | | ) | const |
|
void DGD::channelbuf::space_chars | ( | const char * | spc = " \t" | ) | |
|
std::string DGD::channelbuf::space_chars | ( | | ) | const |
|
| Return current channel line and column. |
unsigned long DGD::channelbuf::bytes_written | ( | | ) | const |
|
| Return amount of bytes written to the output stream. |
channelbuf::char_type * DGD::channelbuf::find_one_of | ( | const char_type * | s, | | | const unsigned int | n, | | | const char_type * | c_set | | ) | const [protected] |
|
| strchr() equivalent. Given string s with length n, finds a first occurrence of any character found in null-terminated string c_set. |
bool DGD::channelbuf::is_dos_eol | ( | const char_type * | p | ) | const [protected] |
|
Member Data Documentation unsigned int DGD::channelbuf::m_line [private] |
|
unsigned int DGD::channelbuf::m_column [private] |
|
unsigned int DGD::channelbuf::m_indent [private] |
|
unsigned int DGD::channelbuf::m_indent_step [private] |
|
unsigned int DGD::channelbuf::m_min_width [private] |
|
unsigned int DGD::channelbuf::m_max_width [private] |
|
bool DGD::channelbuf::m_wrap [private] |
|
bool DGD::channelbuf::m_word_wrap [private] |
|
const char_type* DGD::channelbuf::m_word_pos [private] |
|
std::string DGD::channelbuf::m_spaces [private] |
|
unsigned long DGD::channelbuf::m_bytes [private] |
|
The documentation for this class was generated from the following files: Generated on Thu Aug 10 16:48:30 2006 for DGD Library by 1.3 |