w11 - cpp 0.794
Backend server for Rlink and w11
|
I/O appicator to generate fill characters. More...
#include <RosFill.hpp>
Public Member Functions | |
RosFill (int count=0, char fill=' ') | |
Constructor. | |
int | Count () const |
Get repeat count. | |
char | Fill () const |
Get fill character. | |
Private Attributes | |
int | fCount |
blank count | |
char | fFill |
fill character | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, const RosFill &obj) |
ostream insertion operator. | |
std::string & | operator<< (std::string &os, const RosFill &obj) |
string insertion operator. | |
I/O appicator to generate fill characters.
An RosFill
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 RosFill
is to implement indention, especially when the amount of indention is only known at runtime. The a Dump() function of a class may use use RosFill
following the pattern:
The indention is passed with indent
. The object bl
is setup to create 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 indent+2
). This finally produces a nicely structured output.
Definition at line 24 of file RosFill.hpp.
|
inline |
Constructor.
The fill character is specified with fill, the repeat count is specified with count. Note, that RosFill does not have a default constructor and that this constructor is the only means to set this object up. Note also, that the fill argument can be omitted, the default fill character is a blank.
Definition at line 27 of file RosFill.ipp.
|
inline |
Get repeat count.
Definition at line 35 of file RosFill.ipp.
References fCount.
Referenced by operator<<().
|
inline |
Get fill character.
Definition at line 43 of file RosFill.ipp.
References fFill.
Referenced by operator<<().
|
related |
ostream insertion operator.
Definition at line 60 of file RosFill.cpp.
|
related |
string insertion operator.
Definition at line 72 of file RosFill.cpp.
|
private |
|
private |