FBB::Table(3bobcat)
π FBB::Table β the bobcat manual page, section 3 π
okay bestie sit down, hydrate, because we're doing tables today and I need you to be SO locked in π This is the FBB::Table(3bobcat) page, part 1, and it's giving serious main-character Unix energy. Let's go.
β¨ NAME β¨
FBB::Table β generates row- or column-wise filled tables π¦
β¨ SYNOPSIS β¨
#include <bobcat/table>
Linking option: -lbobcat
β¨ DESCRIPTION β¨
okay so, FBB::Table objects make tables. That's it, that's the vibe π Tables get filled either column-wise or row-wise, your choice. And you can fine-tune basically every little characteristic using a separate FBB::TableSupport object (cf. tablesupport(3bobcat)). And if you don't bother with a FBB::TableSupport object at all? You get a plain table, filled row-wise or column-wise, that you can insert straight into a std::ostream. No notes. β¨
Tables defined by Table consist of rows and a fixed number of columns. The number of columns gets specified at construction time. The number of rows? That also depends on how many elements you actually insert. Columns and rows are addressed using indices β and those start at 0, bestie, not 1 π
Separators are defined before the leftmost column, between the columns, and beyond the last column. By default these separators are empty (sad, boring, empty), but each separator may be given a (fixed) width or content. The separator before column col is addressed as separator col, and the rightmost separator is addressed as separator nColummns. π«Ά
Rows can also be separated from each other using separators. These separating rows are 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 get defined using FBB::TableSupport objects (cf. tablesupport(3bobcat)). Not me using the plain-object constructor and getting zero separatorsβ¦ couldn't be me π
Table objects look a lot like ostream objects, and they use a super simple way to define new elements: each new insertion defines another table element. The catch? It's genuinely difficult to end a row before it has received its nColumn number of elements. That's just the rules π
Table's sister class, TableBuf, is a std::streambuf type of class, and it offers additional control through the use of a wrapping ostream class object. Sister supremacy, we love to see it πΈ
β¨ NAMESPACE β¨
FBB
All constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB. Periodt.
β¨ INHERITS FROM β¨
std::ostringstreamβTableinherits fromstd::ostringstream, which is lowkey the whole reason you can insert into aTableobject. Each separate insertion adds another element to theTableobject. πFBB::TableBaseβ this class implements common elements of the table implementation. Heads up: theTableBaseclass is not intended to be used by itself, and no separate man-page is provided for it. Facilities provided byTablewhich were inherited fromTableBaseare described in this man-page. iykyk π
β¨ ENUMERATIONS β¨
The following enumerations are defined by the class FBB::Table:
enum FillDirection
This enumeration defines two values:
ROWWISEβ specify this value at construction time and elements get added row-wise to the table. I.e., the second element inserted into theTablewill be found in the second column of the first row. β¨COLUMNWISEβ specify this value at construction time and elements get added column-wise to the table. I.e., the second element is found in the second row of the first column. π¦
enum WidthType
This enumeration defines two values:
COLUMNWIDTHβ specify this value when the columns may have variable widths. In this case each column will be as wide as its widest element. This is the defaultWidthTypeused byTableobjects. πEQUALWIDTHβ specify this value when all of the table's columns must have equal widths (i.e., equal to the width of the widest table element). π
β¨ CONSTRUCTORS β¨
Table(size_t nColumns, Table::FillDirection direction, Table::WidthType widthType = Table::COLUMNWIDTH)β the table's number of columns, the fill directions and the column width-type must be provided. The number of rows is implied by the combination of this parameter and the number of elements that is actually inserted into theTableobject. The direction parameter specifies the way new elements are added to theTableobject: row-wise or column-wise. Finally, the widthType parameter is used to specify the way the width of the table's columns is determined. Each column either defines its own width or all columns have equal widths. πTable(TableSupport &tableSupport, size_t nColumns, Table::FillDirection direction, Table::WidthType widthType = Table::COLUMNWIDTH)β this constructor operates identically to the previous constructor, but expects an additional reference to aTableSupportobject. ATableSupportobject offers additional formatting features used by the table defining elements like horizontal lines between rows, additional separators, etc, etc. TheTableSupportobject is passed as a non-const reference, because theTableobject must be able to manipulate its data. Seetablesuppport(3bobcat)for more information aboutTableSupport. π«Ά
Copy and move constructors (and assignment operators) are not available. π
β¨ OVERLOADED OPERATORS β¨
std::ostream &operator<<(std::ostream &str, Table &table)β this operator inserts aTableinto astd::ostreamobject. It requires a non-const table, because it may have to complete the table by adding empty elements (i.e., empty strings) to obtain a completely filled rectangular table. π₯Table &operator<<(Table &obj, Align const &align)β this operator changes the default alignment of either a column or an element. It's a wrapper around the membersetAlign(description's down below, bestie). By default, all elements are right-aligned (see alsoalign(3bobcat)). β¨Table &operator<<(Table &obj, Type const &item)β this operator is defined as a function template:Typeis a template type parameter instantiated to a type for whichstd::ostringstreaminsertions are possible. It inserts the value/object item into theTable'sstd::ostringstreambase class object as the table's next element. π
β¨ MEMBER FUNCTIONS β¨
Table &append(std::string const &text char const *sep = " \t", bool addEmpty = false)β fields in text separated by one of the characters in sep are added as elements to theTableobject. Empty fields are ignored β unless the addEmpty parameter istrue. πvoid clear()β the content of the table is erased. poof πvoid clearStr()β the content of itsstd::ostringstreambase class buffer is erased.Table &def()β after inserting elements into aTableobject, its number of elements may or may not be an integral multiple of the number of columns specified at construction time. To "complete" aTableobject to a rectangular object, for which all column widths and alignments have been determined,defcan be called. It is automatically called byoperator<<(ostream, Table). In other situations it may be called explicitly to force the insertion of another row in a table usingROWWISEinsertions. WithCOLUMNWISEinsertions its working is complex, since new elements added to aCOLUMNWISEfilled table will reshuffle its elements over the table's columns. πvoid fill(InputIterator begin, InputIterator end)β this member is defined as a member template;InputIteratoris a template type parameter representing any input iterator. It can also be, e.g., a pointer to an insertable type. The iterators must point to data elements which can be inserted into anstd::ostream. The range of values implied by the member's iterator pair are inserted into the table as new elements. πvoid push_back(std::string const &element)β new elements can be added to the table usingpush_back. It could, e.g., be called from aback_inserteradaptor. π¦size_t nRows()β the table's current number of rows is returned. It is initialized to0, and after that updated whendefhas been called. β¨Table &setAlign(Align const &align)β the alignment type of either a column or an element of theTableobject is defined usingsetAlign. The standard alignmentsstd::left,std::rightandstd::internalmay be specified, but in addition the alignmentFBB::centermay be used if elements should be centered into their column. A construction like
tab << Align(2, FBB::center)
requests centering of all elements in the table's column having index value 2 (i.e., the table's 3rd column), whereas a construction like
tab << Align(2, 3, FBB::center)
requests centering of element [2][3]. It is the responsibility of the programmer to ensure that such elements exist. By default, all elements are right-aligned. ) β yes, the original page leaves a lil orphan ) there, and honestly? iconic, we're keeping her. π
π MANPULATORS π
(yes bestie, that's genuinely how the section is spelled in the original page, and we are NOT fixing her, she's doing great)
Table &def(Table &table)β this manipulator can be inserted into a table to call the table'sdefmember. π
β¨ EXAMPLE β¨
#include <iostream>
#include <bobcat/table>
#include <bobcat/tablelines>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
{
TableLines tablelines;
// width/separators of cols 0, 1 and 2
tablelines << 0 << " | " << " | ";
// hline over cols 1 and 2 of row 1
tablelines << TableLines::HLine(1, 1, 3);
Table tab(tablelines, 3, Table::ROWWISE, Table::EQUALWIDTH);
// or: Table tab(tablelines, 3, Table::ROWWISE);
tab << Align(0, std::left); // set column non-default alignment
tab.fill(argv + 1, argv + argc);// fill range of values
cout << tab << β\nβ; // complete the table and insert
tab << "hello" << "" << "wo"; // add additional elements.
if (tab.nRows() > 2)
tab << Align(2, 2, center); // set the layout of a specific element
cout << tab << β\nβ;
}
like?? she's beauty, she's grace, she's filling argv into a table ππ«Ά
β¨ FILES β¨
bobcat/tableβ defines the class interface; π
β¨ SEE ALSO β¨
bobcat(7), align(3bobcat), csvtable(3bobcat), manipulator(3bobcat), tablebuf(3bobcat), tablelines(3bobcat), tablesupport(3bobcat)
β¨ BUGS β¨
Note thatdef()will reshuffle elements over the table's columns when new elements are added to the table subsequent to callingdef(). Not a drill, bestie β she will literally move your stuff around. π
okay and that's part 1, but we are SO not done here β part 2 is coming and it has more of the goods, so stay seated, keep your -lbobcat linked, and hydrate πβ¨
π BOBCAT PROJECT FILES π
okay so if you wanna come hang out where the source actually lives, bestie, here's the whole map π
https://fbb-git.gitlab.io/bobcat/: gitlab project page;
and then the Debian Bobcat project files, which are their own whole lil ecosystem π
libbobcat6: debian package containing the shared library, changelog and copyright note;libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;
β¨ BOBCAT β¨
and in case you were sitting there wondering what the name even means π Bobcat is an acronym of `Brokkenβs Own Base Classes And Templatesβ.
it's giving... named after the author, which honestly? iconic. main character energy. he said "these are my base classes and templates" and the name stuck, periodt. π
π COPYRIGHT π
This is free software, distributed under the terms of the GNU General Public License (GPL).
fr fr it's free, babes β free as in the GPL kind of free, so go read the license, it's not scary, it's slay πΈ
π AUTHOR π
Frank B. Brokken (f.b.brokken@rug.nl).
okay that's the whole page, we ATE that π no crumbs left. every option, every default, every file, every signature β all preserved, all iconic, all still exactly as documented π¦
this one came from libbobcat-dev_6.15.01, dated 2005-2026 β yeah, two decades of Bobcat and it's still cute. go forth and #include responsibly, bestie πβ¨π
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms