Helper template to display tables to the console where the headings of the
columns are the names of the fields of a struct, and where the contents of
each row of the table are the values of the fields of an instance of the
struct type.
Boost Software License Version 1.0. See LICENSE_BOOST.txt for details.
Alternatively, this file may be distributed under the terms of the Tango
3-Clause BSD License (see LICENSE_BSD.txt for details).
Helper template to display tables to the console where the headings of the columns are the names of the fields of a struct, and where the contents of each row of the table are the values of the fields of an instance of the struct type.
Usage example:
The output of the usage example would be:
number | fraction | name |
import ocean.text.convert.Formatter;
class TestTable : StructTable!(Test) { override protected char[] fraction_string ( float* field ) { this.format_buffer.length = 0; sformat(this.format_buffer, "{}%", *field * 100.0); return this.format_buffer; } }
scope table2 = new TestTable;
table2.addRow(Test(23, 0.12, "gavin")); table2.addRow(Test(17, 0.999, "david")); table2.addRow(Test(11, 0.1, "luca"));
table2.display();
23 | 12.00% | gavin | 17 | 0.999% | david | 11 | 0.10% | luca |