other versions
- wheezy 3.01.00-1+b1
- jessie 3.23.01-1
- testing 4.04.00-1
- unstable 4.04.00-1
- experimental 4.07.00-1
other sections
FBB::Table(3bobcat) | Table-formatter | FBB::Table(3bobcat) |
NAME¶
FBB::Table - Generates row- or column-wise filled tablesSYNOPSIS¶
#include <bobcat/table>DESCRIPTION¶
FBB::Table objects 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 using 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. Tables defined by Table 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)). Table objects look a lot like ostream objects, but they also adopt a fairly rigid way to define new elements: each new insertion defines another table element, and it is difficult to end a row before it has received its nColumn number of elements. Table’s sister-class, TableBuf, is a std::streambuf type of class, offering additional control through the use of a wrapping ostream class object.NAMESPACE¶
FBBINHERITS FROM¶
std::ostringstream - Table inherits from std::ostringstream, allowing insertions into a Table object. Each separate insertion adds another element to the Table object. 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 by the class FBB::Table: enum FillDirection- o
- ROWWISE:
- o
- COLUMNWISE:
- o
- COLUMNWIDTH:
- o
- EQUALWIDTH:
CONSTRUCTORS¶
- o
- Table(size_t nColumns, Table::FillDirection
direction, Table::WidthType widthType = Table::COLUMNWIDTH):
- o
- Table(TableSupport &tableSupport,
Table::FillDirection direction, Table::WidthType widthType =
Table::COLUMNWIDTH):
OVERLOADED OPERATORS¶
- o
- std::ostream &operator<<(std::ostream
&str, Table &table):
- o
- Table &operator<<(Table &obj, Align const
&align):
- o
- Table &operator<<(Table &obj, Type const
&x):
MEMBER FUNCTIONS¶
- o
- Table &append(std::string const &text
char const *sep = " \t", bool addEmpty = false):
- o
- void clear():
- o
- void clearStr():
- o
- void fill(InputIterator begin, InputIterator end):
- o
- void push_back(std::string const &element):
- o
- size_t nRows():
- o
- Table &setAlign(Align const &align):
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 liketab << 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.
- o
- Table &def():
MANPULATORS¶
- o
- Table &def(Table &table):
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’; }
FILES¶
bobcat/table - defines the class interface;SEE ALSO¶
bobcat(7), align(3bobcat), manipulator(3bobcat), tablebuf(3bobcat), tablelines(3bobcat), tablesupport(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()DISTRIBUTION FILES¶
- o
- bobcat_3.01.00-x.dsc: detached signature;
- o
- bobcat_3.01.00-x.tar.gz: source archive;
- o
- bobcat_3.01.00-x_i386.changes: change log;
- o
- libbobcat1_3.01.00-x_*.deb: debian package holding the libraries;
- o
- libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages;
- o
- http://sourceforge.net/projects/bobcat: public
archive location;
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).2005-2012 | libbobcat1-dev_3.01.00-x.tar.gz |