class table : public object

Html Table object.

Inheritance:


Public Methods

table(void)
Default constructor.
table(const std::string& title)
Construct a table with a title
table(const table& x)
Copy constructor.
~table(void)
Table destructor.
object* clone(void) const
Clone a table.
table& operator=(const table& x)
Table assignment operator.
void write(writer& out) const
Write the table to the HTML document.
int addColumn(const std::string& title)
Add a column.
int addRow(void)
Add an empty row to the end of the table
void eraseRow(int row, int count=1) throw(std::runtime_error)
Erase one or more rows.
void insertData(int row, int col, double x, int wid=-1, int prec=-1) throw(std::runtime_error)
Insert floating point numeric data into the cell at the specified row and column
void insertData(int row, int col, long x, int wid=-1, int radix=10) throw(std::runtime_error)
Insert integer data with an arbitrary radix into the cell at the specified row and column
void insertData(int row, int col, const std::string& txt) throw(std::runtime_error)
Insert text data into the cell at the specified row and column
void insertData(int row, int col, const object& obj) throw(std::runtime_error)
Insert an arbitrary html object into the cell at the specified row and column
void insertRow(int row) throw(std::runtime_error)
Insert an empty row in front of the specified row number
int getNRow(void) const
Get the number of rows.
int getNColumn(void) const
Get the number of columns.
cell& refHeader(int col) throw(std::runtime_error)
Get a column header reference.
const cell& refHeader(int col) const throw(std::runtime_error)
Get a column header reference.
cell& refCell(int row, int col) throw(std::runtime_error)
Get a specified cell reference.
const cell& refCell(int row, int col) const throw(std::runtime_error)
Get a specified cell reference.
void setBorder(bool On=true)
Enable/disable cell borders.

Inherited from object:

Public Methods

virtual dim_t getXSize(void) const
virtual dim_t getYSize(void) const

Documentation

The html table class stores a representation of an html table. The table contains an arbitrary number of rows and columns with each entry containing a pointer to an html cell object. Each column has an optional header containing a title and attributes which are inherited by all cells in the column.
table(void)
Construct an empty table.

table(const std::string& title)
Construct an empty html table and set the title.
Parameters:
initial - title string

table(const table& x)
Construct an exact copy of the specified table.

~table(void)
Table destructor.

object* clone(void) const
Create an exact copy of the table. This implements the virtual html::object function.
Returns:
Pointer to a new table object.

table& operator=(const table& x)
Set the table contents to that of the argument table.
Parameters:
x - Table whose contents are to be copied.

void write(writer& out) const
Write the table to an HTML document stream.

int addColumn(const std::string& title)
Add a column to the table. all needed columns should be added to the table before adding rows or filling in cells.

int addRow(void)
Add an empty row to the end of the table. The row number is returned.

void eraseRow(int row, int count=1) throw(std::runtime_error)
Erase the specified row(s) from the table. All valid cells in the deleted rows are deleted.
Parameters:
Row - Number of first row to be erased
count - Number of rows to be erased

void insertData(int row, int col, double x, int wid=-1, int prec=-1) throw(std::runtime_error)
Insert floating point numeric data into the cell at the specified row and column. If a cell exists at the specified location, its contents are replaced. Otherwise a new cell is created.

void insertData(int row, int col, long x, int wid=-1, int radix=10) throw(std::runtime_error)
Insert integer data with an arbitrary radix into the cell at the specified row and column. If a cell exists at the specified location, its contents are replaced. Otherwise a new cell is created.

void insertData(int row, int col, const std::string& txt) throw(std::runtime_error)
Insert text data into the cell at the specified row and column. If a cell exists at the specified location, its contents are replaced. Otherwise a new cell is created.

void insertData(int row, int col, const object& obj) throw(std::runtime_error)
Insert an arbitrary html object into the cell at the specified row and column. If a cell exists at the specified location, its contents are replaced. Otherwise a new cell is created.

void insertRow(int row) throw(std::runtime_error)
Insert an empty row in front of the specified row number. The new row will have number row and all existing rows numbered i >= row will have their row number incremented. If row is not valid (row < 0 or row > nRow) a runtime_error exception will be thrown after creating a new row at the end of the table.

int getNRow(void) const
Get the current number of rows in the table.

int getNColumn(void) const
Get the number of columns defined in the table.

cell& refHeader(int col) throw(std::runtime_error)
Get a reference to the header for the specified column.

const cell& refHeader(int col) const throw(std::runtime_error)
Get a constant reference to the header for the specified column.

cell& refCell(int row, int col) throw(std::runtime_error)
Get a reference to the cell at a specified location within the table.

const cell& refCell(int row, int col) const throw(std::runtime_error)
Get a constant reference to the cell at a specified location within the table.

void setBorder(bool On=true)
Set the table border attribute. If the border attribute is set, a border is drawn around each cell of the table.


This class has no child classes.
Author:
J. Zweizig
Version:
1.1; Modified May 2, 2001

alphabetic index hierarchy of classes


generated by doc++