Small C++ library which allows to generate printable tables like this:
+-------+---------+---+
| Foo | Bar | - |
+-------+---------+---+
| 12345 | X | y |
| 123 | 12345-r | n |
| 2345 | Y | n |
+-------+---------+---+
See unittest/TableTest.cpp for usage reference.
- Generates ASCII art tables with dynamic or fixed width columns
- Stream output (i.e. cout, stringstream, fstream etc.)
- Horizontal alignment based on column settings with the ability to override the alignment per cell
- Compact output supported by omitting the upper and lower border and spaces within table cells
- Color support using ANSI code sequences supported by the vast majority of terminals (foreground and background coloring)
- No external dependencies other than C++ standard library
To build the Debian/Ubuntu package from these sources please clone the repository and run
dpkg-buildpackage -uc -us -b
Then install the packages using
sudo dpkg -i ../libtabularasa*.deb
Make sure you have debhelper installed (sudo apt install debhelper).
The package provides a pkg-config file which allows to integrate the library using autotools and/or cmake.
Have a look into unittest/TableTest.cpp on how to use the library.
The unittests are using GTest (Google Test Framework) shipped with this repository (see external/gtest/LICENSE for details).
To compile and execute the unittest do the following
mkdir build && cd build
cmake -DWITH_UNITTESTS=True .. && make gtest && ./gtest
A coverage report can be generated by using i.e. gcovr as follows:
gcovr build -r tabularasa -s --html -o contrib/coverage.html