FBB::Table(3bobcat)

Construct text tables
(libbobcat-dev_6.04.00)

2005-2023

NAME

FBB::Table - Generates row- or column-wise filled tables from information inserted into a std::ostream

SYNOPSIS

#include <bobcat/tablebuf>
Linking option: -lbobcat

DESCRIPTION

FBB::Tablebuf objects are std::streambuf objects that can be used to create tables. The tables are filled either column-wise or row-wise. Many of the table's characteristics may be fine-tuned by a separate FBB::TableSupport object, described in a separate man-page (TableSupport(3bobcat)). When no FBB::TableSupport object is used, a plain row-wise or column-wise table is constructed which can be inserted into a std::ostream. Displaying a table (e.g., at the standard output stream) involves the following steps:

Tables defined by TableBuf consist of a (number of element dependent) number of rows and a fixed number of columns, the latter value is specified at construction time. Columns and rows are normally addressed using index values (starting at 0). Before the leftmost column, between the columns and beyond the last column separators are defined. By default the separators are empty, but each separator may be given a (fixed) width or content. The separator before column col is addressed as separator col, the rightmost separator is addressed as separator nColummns.

Likewise, rows can be separated from each other using separators. These separating rows are also empty by default. The row-separator before row row is addressed as row-separator row. The row-separator following the final row is addressed as row-separator nRows, where nRows is the value returned by the nRows member function.

Non-default (i.e., non-empty) separators are defined using FBB::TableSupport objects (cf. tablesupport(3bobcat)).

TableBuf's sister-class Table can be used to insert elements into a table in a more direct way. With TableBuf field separators are used to switch to the next table-element, and (with row-wise filled tables) a row separator can be used to switch to the next row when it's only partially defined. Instead, with Table objects each new insertion defines another table element, and no wrapping std::ostream object is required.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

std::streambuf - allowing TableBuf objects to be wrapped in std::ostream objects.

FBB::TableBase - This class implements common elements of the table implementation (the FBB::TableBuf class is also derived from TableBase). The TableBase class is not intended to be used otherwise, and no separate man-page is provided. All facilities provided by Table inherited from TableBase are described in this man-page.

ENUMERATIONS

The following enumerations are defined in the class FBB::Tablebuf.

enum FillDirection
This enumeration has two values:

enum WidthType
This enumeration holds two values:

CONSTRUCTORS

Copy and move constructors (and assignment operators) are not available.

OVERLOADED OPERATORS

MEMBER FUNCTIONS

MANPULATORS

EXAMPLE

#include <iostream>
#include <ostream>
#include <string>
#include <algorithm>
#include <iterator>

#include <bobcat/tablebuf>
#include <bobcat/tablelines>

using namespace std;
using namespace FBB;

int main()
{
    TableLines tablelines;

    tablelines << 0;            // set separator widths
    for (size_t sep = 0; sep != 8; ++sep)
        tablelines << 3;


    TableBuf tab(tablelines, 8, TableBuf::ROWWISE);

    ostream out(&tab);

    copy(istream_iterator<string>(cin), istream_iterator<string>(),
            ostream_iterator<string>(out, "\b"));

    cout << tab << '\n';            // complete the table and insert
}

FILES

bobcat/tablebuf - defines the class interface;

SEE ALSO

bobcat(7), align(3bobcat), csvtable(3bobcat), manipulator(3bobcat), tablelines(3bobcat), tablesupport(3bobcat), table(3bobcat)

BUGS

Note that def() will reshuffle elements over the table's columns when new elements are added to the table subsequent to calling def()

BOBCAT PROJECT FILES

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).