#include "CTBosFill.hxx"
Public Methods | |
CTBosFill (CTBint i_count=0, char c_fill='') | |
CTBint | Count () const |
char | Fill () const |
Private Attributes | |
CTBint | mi_count |
char | mc_fill |
Related Functions | |
(Note that these are not member functions.) | |
ostream & | operator<< (ostream &os, const CTBosFill &osf) |
An CTBosFill
object will add a given number of fill characters to an output stream each time the object is inserted into the stream. The fill character and the repeat count are specified when the object is constructed.
A typical usage of CTBosFill
is to implement indention, especially when the amount of indention is only known at runtime. The Dump()
functions of many CTB
classes use CTBosFill
following the pattern:
void xyz::Dump(int i_indent,ostream& os) const { CTBosFill bl(i_indent); os << bl << "-- xyz " << " @ " << this << endl; os << bl << " mi_v1: " << mi_v1 << endl; os << bl << " mi_v1: " << mi_v1 << endl; m_embed.Dump(i_indent+2,os); return; }
The indention is passed with i_indent
. The object bl
is setup to create i_indent
blanks and thrown into the outstream os
at the start of each output line. The Dump()
function of member variables of class type is called with a increamented indention (here i_indent+2)
. This finally produces a nicely structured output.
Definition at line 16 of file CTBosFill.hxx.
|
Constructor. The fill character is specified with c_fill, the repeat count is specified with i_count. Note, that CTBosFill does not have a default constructor and that this constructor is the only means to set this object up. Note also, that the c_fill argument can be omitted, the default fill character is a blank. Definition at line 23 of file CTBosFill.icc. |
|
Get repeat count.
Definition at line 31 of file CTBosFill.icc. Referenced by operator<<().
|
|
Get fill character.
Definition at line 39 of file CTBosFill.icc. Referenced by operator<<().
|
|
ostream insertion operator.
Definition at line 53 of file CTBosFill.cxx. |
|
Definition at line 26 of file CTBosFill.hxx. |
|
Definition at line 27 of file CTBosFill.hxx. |