FBB::Table

FBB::Table

libbobcat1-dev_2.02.03-x.tar.gz

2005-2009


FBB::Table(3bobcat)

FBB::Table(3bobcat)

libbobcat1-dev_2.02.03-x.tar.gz Table-formatter

2005-2009

NAME

FBB::Table - Generates row- or column-wise filled tables

SYNOPSIS

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

DESCRIPTION

FBB::Table objects may 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 will be constructed which can be inserted into a std::ostream.

NAMESPACE

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

INHERITS FROM

std::ostringstream - Table inherits from std::ostringstream, allowing insertions into a Table object. Each separate insertion adds another element to the Table object.

ENUMERATIONS

The following enumerations are defined in the class FBB::TableSpec, allowing the programmer to specifiy values like FBB::TableSpec::Vertical rather than FBB::Table<std::istream_const_iterator>::Vertical.

enum FillDirection
This enumeration holds two values:

enum WidthType
This enumeration holds two values:

CONSTRUCTORS

The copy constructor is not available.

OVERLOADED OPERATORS

The overloaded assignment operator is not available.

MEMBER FUNCTIONS

MANPULATORS

EXAMPLE

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>

#include <bobcat/fnwrap1c>
#include <bobcat/table>

using namespace std;
using namespace FBB;

class Support: public TableSupport
{
    public:
//        virtual void hline(size_t row) const;
        virtual void vline(size_t col) const;
        virtual void vline() const;
    private:
//        static void outLine(Element const &element, ostream &out);
};

//void Support::hline(size_t row) const
//{
//    if (row == 0 || row == nRows())
//        out() << setfill('-') << setw(width()) << "-" << setfill(' ');
//    else  
//    {
//        const_iterator fieldIt = begin(row);
//
//        if (fieldIt == end())
//            return;
//
//        for_each(fieldIt, end(), 
//                FnWrap1c<Element const &, ostream &>(outLine, out()));
//    }
//    out() << endl;
//}
//
//void Support::outLine(Element const &element, ostream &out)
//{
//    if (element.width == 0)
//        return;
//
//    if (element.type == SKIP)
//        out << setw(element.width) << " ";
//    else
//        out << setfill('-') << setw(element.width) << "-" << setfill(' ');
//}
//
void Support::vline(size_t col) const
{
    if (col < sep().size())
        out() << sep()[col];
}

void Support::vline() const
{
    vline(nColumns());
    out() << "\n";
}


int main(int argc, char **argv)
{
    Support support;

    support << 0 << " | " << " | ";

    support << Support::HLine(1, 1, 3); // row[1] separator for cols 1 and 2

    Table tab(support, 3, Table::ROWWISE, Table::EQUALWIDTH);
//    Table tab(support, 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 << endl;            // 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 << endl;

    return 0;
}

FILES

bobcat/table - defines the class interface;

SEE ALSO

bobcat(7), align(3bobcat), manipulator(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

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).