FBB::TableSupport(3bobcat)
π FBB::TableSupport(3bobcat) β the Table Support base class π
okay bestie, welcome to FBB::TableSupport β this is part 1 of the page, so grab a snack, we're going in β¨
β¨ NAME β¨
FBB::TableSupport β it defines the protocols for Table-support classes. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <bobcat/tableSupport>
Linking option: -lbobcat
π¦ DESCRIPTION π¦
so FBB::TableSupport is used by FBB::Table and FBB::TableBuf objects, and it handles some of their functionality for them. you can derive your own classes from TableSupport and override its virtual members to decide the actual layout of your tables. and by default? the virtual members of TableSupport do not separate the columns of the table from each other. like, at all. no divider, no drama π
the Bobcat library also offers a specialized class, TableLines, which extends the basic facilities of TableSupport by giving you facilities to separate rows with (partial) horizontal lines β check tablelines(3bobcat) for the details. π§
want even more specialized handling? then derive new classes from FBB::TableSupport and override members so they implement what you, the programmer, actually want. an object of that derived class can be handed to a FBB::Table or FBB::TableBuf constructor, and boom β the special handling is activated. main character energy fr fr π
π NAMESPACE π
FBB
All constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB.
β INHERITS FROM β
-
(yep. nothing. it's a base class, an original, an icon π)
π ENUMERATION π
the enum ColumnType defines these values (and yeah, scroll down for the struct HLine description because they're besties):
SKIPβ a section of a row-separating line should stay empty. this value is normally not used by applications;USEβ a section of a row-separating line should be used (like, by writing a (horizontal) line);LEFT_FULLβ a (horizontal) line should be written over the total width of the separator to the left of a series of columns;RIGHT_FULLβ a (horizontal) line should be written over the total width of the separator to the right of a series of columns;LEFT_MIDβ a (horizontal) line should be written over the right-half part of the width of the separator to the left of a series of columns; the left-hand part stays blank;RIGHT_MIDβ a (horizontal) line should be written over the left-half part of the width of the separator to the right of a series of columns; the right-hand part stays blank.
heads up! the valueSKIPshould always be used by itself. the remaining values of the enum may be combined using the binary or (|) operator. π
π
PUBLIC TYPE HLine π
struct HLineβ this struct has the following fields:
size_t d_row;
size_t d_begin;
size_t d_end;
size_t d_type;
it offers two constructors:
HLine(size_t row, size_t begin, size_t end)HLine(ColumnType type, size_t row, size_t begin, size_t end)β objects of typeTableSupport::HLinemay be inserted into aTableSupportobject to specify section(s) of a horizontal separator between table rows that should be displayed or skipped. π«Ά
so, like, say you want to specify that a separator should be written:
- in row 1,
- from column 2 up to (but not including) column 5,
- extending the separator to the left by half the width of the separator between columns 1 and 2, and to the right by the full width of the separator between columns 4 and 5 β
then you insert this HLine object into the TableSupport ts object:
ts << HLine(LEFT_MID | RIGHT_FULL, 1, 2, 5);
multiple HLine objects may be inserted, in any order, into TableSupport objects. and when column ranges overlap? their ColumnTypes are merged. slay π₯
π PROTECTED TYPES π
const_iteratorβ theconst_iteratoris defined in the class's protected section. it's an input-iterator returning iterators tostruct Field(see below) objects
for table columns and column separators (see below at the begin and end members)
struct Fieldβ aFieldhas two data members:widthandtype, representing, respectively, the width andColumnTypeof a column or separating column. the type values ofFieldobjects returned byTableSupportmembers only contain single values (likeSKIPorLEFT_MID) β note that column types can be combined when inserted into Table objects usingHLineobjects. πΈ
π CONSTRUCTORS π
the default, copy and move constructors as well as the copy and move assignment operators are available. all of them, no gatekeeping π
β¨ OVERLOADED OPERATORS β¨
the following overloaded operators define separators between columns. the first value inserted into a TableSupport object defines the separator before column 0, the next one defines the separator before column 1, etc, until inserting separator nColumns + 1, which defines the separator to the right of the table's last column. inserting additional separators are ignored. periodt π
TableSupport &operator<<(TableSupport &support, size_t width)β this operator defines a column-separator ofwidthspace characters.widthmay be zero, in which case no visible separator is used;TableSupport &operator<<(TableSupport &support, std::string const &text)β this operator defines a separator throughtext. the length of thetextdefines the width of the separator. no separator is used whentextis empty;TableSupport &operator<<(TableSupport &support, HLine const &hsep)β this operator defines how a horizontal separator of a specified row should be displayed (see theHLinedescription above). π¦
π₯ PUBLIC MEMBER FUNCTIONS π₯
void hline(size_t row) constβ when inserting a table into astd::ostream,TableandTableBufobjects call this member just before the indicatedrow(offset) is inserted into astd::ostream. it calls the virtual memberv_hline, passing itrow. by defaultv_hlineperforms no actions;void hline() constβ when inserting a table into astd::ostream,TableandTableBufobjects call this member just after inserting the table's final row. it calls the virtual memberv_hlinewithout arguments, which by default callshline(nRows);void setParam(std::ostream &ostr, size_t nRows, size_t nColumns, std::vector<Align> const &align)β this member provides theTableSupportobject with values that are essential for its proper functioning. it is called by theTableandTableBuf'sdefmember (and manipulator) to configure theTableSupportwith alignment specifications, where:ostris a reference to thestd::ostreamto receive the table,nRowsspecifies the table's number of rows,nColumnsspecifies the table's number of columns,alignis a reference to a constant vector of (column) alignment specifications;
void vline(size_t col) constβ when inserting the data elements of the rows of a table into astd::ostream,TableandTableBufobjects call this member just before inserting the data elements of columncol. its task is to write a column separator just before the data elements themselves. it calls the virtual memberv_vline, passing it itscolparameter. by defaultv_vlineinserts the column separator of columncol;virtual void vline() constβ when inserting a table into astd::ostream,TableandTableBufobjects call this member after inserting the data elements of the rows of the table. it is called at the end of each row. it calls the virtual memberv_vlinewithout arguments, by default callingvline(nColumns)and inserting a newline into theostream;size_t width() constβ returns the width of the table in number of characters. it may be called before actually inserting the table into a stream. π
π PROTECTED MEMBER FUNCTIONS π
the following members are available to classes derived from TableSupport. except for sep and sepWidth, their values are only defined after calling setParam, which is called from the def member or manipulator of Table or TableBuf objects.
std::vector<Align> const &align() constβ a reference to a vector ofAlignobjects, defining the alignments and widths of the table's columns, is returned.const_iterator begin(size_t row) constβ an iterator is returned containing information about the first column element when displaying the horizontal separator before linerow. use argumentnRows()to obtain the information about the separator beyond the last row. thecolumn elementsof the table consist of its separators and data columns.
dereferencing the returned const_iterator returns a Field struct containing information about the width and type of a column element. dereferencing the iterator returned by begin provides information about the leftmost column separator. by incrementing the iterator all subsequent column elements are visited. dereferencing the iterator is defined until the iterator has reached the value returned by end (see below);
size_t colWidth(size_t col) constβ the width of the indicated column is returned;const_iterator end(size_t row) constβ an iterator indicating the end of the iterator range starting atbegin(row)is returned;size_t nColumns() constβ the table's number of columns is returned;size_t nRows() constβ the table's number of rows is returned;std::ostream &out() constβ a reference to the stream into which the table is inserted is returned;std::vector<std::string> const &sep()β a reference to the separators defined for the table's columns is returned. elementcolrefers to the separator to the left of the table's columncol, elementnColumns()refers to the separator to the right of the rightmost column;size_t sepWidth(size_t col) constβ the width of the indicated separator is returned. elementcolrefers to the separator to the left of the table columncol, elementnColumns()refers to the separator to the right of the rightmost table column. π
that's part 1 bestie!! part 2 is coming, don't go anywhere π
π« VIRTUAL MEMBER FUNCTIONS π«
bestie, these are the little hook points you can override in your own derived class to change up how the horizontal and vertical separators look. you're literally in control of the vibe of your table's skeleton π€β¨
virtual void v_hline(size_t row) constβ this one gets called fromhline(size_t row)and it receives that same row parameter, no cap π«Ά its whole job is to write a horizontal separator before row number row. by default? nothing happens, literally nothing gets inserted π if you want, you can build that separator by iterating over the range defined by thebeginandendmembers and making decisions based on theFieldobjects you get from dereferencing the iterators. OR β and this is the slay shortcut β if you just want a horizontal line spanning the entire width of the table row, do it like this:
void Derived::v_hline(size_t row) const
{
out() << setfill(β-β) << setw(width()) << "-" <<
setfill(β β);
}
virtual void v_hline() constβ this one's called fromhline()β¨ its task is writing a (partial) horizontal line past the table's last line. default behaviour? it just callshline(nRows). iconic, honestly.virtual void v_vline(size_t col) constβ called fromvline(size_t col)and it gets handed that col parameter πΈ its job is to write a separator before data column col. by default it insertsseparator[col]if that separator is available β and if it's not available, then no separator gets inserted before column col. simple as π§virtual void v_vline() constβ this cutie is called fromvline()at the end of every single one of the table's rows π its task is to write a column separator and to terminate the table's line that it was called for. by default it inserts the final column separator (if it's defined) plus a newline\ncharacter. periodt.
π EXAMPLE π
okay so the example? it lives over in the table(3bobcat) man-page. go peek there, bestie ππ
π FILES π
bobcat/tableSupport β this is the file that defines the class interface, the blueprint of it all β¨
π₯ SEE ALSO π₯
bobcat(7), align(3bobcat), csvtable(3bobcat), table(3bobcat), tablebuf(3bobcat), tablelines(3bobcat)
the whole friend group, tbh π«Ά
π BUGS π
None Reported.
(not one?! we love a flawless queen πβ¨)
π¦ BOBCAT PROJECT FILES π¦
https://fbb-git.gitlab.io/bobcat/: the gitlab project page, your one-stop shop ποΈ
Debian Bobcat project files, coming right up:
libbobcat6: the debian package containing the shared library, changelog and copyright note πlibbobcat-dev: the debian package containing the static library, headers, manual pages, and developer info π οΈ
π BOBCAT π
Bobcat is an acronym of `Brokkenβs Own Base Classes And Templatesβ.
(iykyk β and now you do π)
β 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).
and that's a wrap on the whole page, bestie ππ this was FBB::TableSupport(3bobcat) from the libbobcat-dev_6.15.01 era, dated 2005-2026 β yes she's been around and she's still serving looks. go build smth cute with your tables, mwah πβ¨
π¦ 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