Inheritance diagram for ColumnWriter:
Public Types | |
typedef DisplayWriter put | put |
Public Member Functions | |
this (IBuffer buffer, ColumnList columns) | |
void | reset () |
override int | getWidth () |
IWriter | put (IWritable x) |
IWriter | put (char[] x) |
Static Public Member Functions | |
this () | |
Private Types | |
typedef Number Radix | Radix |
Private Member Functions | |
final void | pad () |
this (IBuffer buffer) | |
this (IConduit conduit) | |
void | setPrecision (uint digits) |
void | setRadix (Radix radix) |
void | setFill (uint width, char fill= ' ') |
Private Attributes | |
int | output |
ColumnList | columns |
Static Private Attributes | |
ubyte | spaces [256] |
This is how one might use ColumnWriter:
static int[] columns = [0, 4, 14, 24]; // map a ColumnWriter directly onto Stdout ColumnWriter write = new ColumnWriter (Stdout.getBuffer(), new ColumnList(columns)); // set 2 digits of precision write.setPrecision (2); // Mango style write (1) (20.34944) ("test") (CR); // iostream style write << 1 << 20.34944 << "test" << CR; // put() style write.put(1).put(20.34944).put("test").cr();
Note that ColumnWriter may be used with files, sockets, or any other buffer-oriented construct.
Definition at line 77 of file ColumnWriter.d.
|
Definition at line 79 of file ColumnWriter.d. Referenced by Formatter::setTarget(). |
|
Definition at line 63 of file DisplayWriter.d. Referenced by DisplayWriter::setRadix(). |
|
Construct a ColumnWriter upon the given IBuffer, with the specified set of columns. Definition at line 92 of file ColumnWriter.d. |
|
Populate the space padding with valid spaces. Reimplemented from AbstractWriter. Definition at line 108 of file ColumnWriter.d. References spaces. |
|
Reset everything back to zero. Typical usage will invoke this whenever a Newline is emitted. Note that we maintain our own internal count of how many bytes have been output: this is because we cannot depend on the Buffer to provide that for us if (a) the buffer is very small, or (b) the buffer is flushed after each write (Stdout etc). Definition at line 126 of file ColumnWriter.d. References columns, and ColumnList::reset(). Referenced by put(). |
|
Definition at line 138 of file ColumnWriter.d. References columns, and ColumnList::getWidth(). |
|
Intercept the IWritable type so we can reset our columns when a newline is emitted. Reimplemented from AbstractWriter. Definition at line 150 of file ColumnWriter.d. References IWriter::put(), and reset(). |
|
Intercept the output so we can write some spaces first. Note that our superclass (DisplayWriter) converts each of its arguments to a char[] first, so this override is able to catch everything emitted.
Reimplemented from AbstractWriter. Definition at line 174 of file ColumnWriter.d. References pad(). |
|
Pad the output with spaces to reach the next column position. This should be invoked before anything is written to the buffer. Definition at line 189 of file ColumnWriter.d. References columns, ColumnList::next(), and spaces. Referenced by put(). |
|
Construct a DisplayWriter upon the specified IBuffer Reimplemented from Writer. Reimplemented in HttpWriter, and FlushWriter. Definition at line 83 of file DisplayWriter.d. References AbstractWriter::enableArrayPrefix(). |
|
Construct a DisplayWriter upon the specified IConduit Reimplemented from Writer. Reimplemented in FlushWriter. Definition at line 111 of file DisplayWriter.d. |
|
Set the number of floating point digits Definition at line 122 of file DisplayWriter.d. |
|
Definition at line 131 of file DisplayWriter.d. References DisplayWriter::Radix. |
|
Definition at line 140 of file DisplayWriter.d. References assert(), and DisplayWriter::tmp. |
|
Definition at line 81 of file ColumnWriter.d. |
|
Definition at line 82 of file ColumnWriter.d. Referenced by getWidth(), pad(), reset(), and this(). |
|
Definition at line 83 of file ColumnWriter.d. |