html::table Class Reference
[Html Document preparation]

#include <table.hh>

Inheritance diagram for html::table:

html::object html::Table2C

List of all members.

Public Member Functions

 table (void)
 table (const std::string &title)
 table (const table &x)
virtual ~table (void)
tableclone (void) const
tableoperator= (const table &x)
void write (writer &out) const
int addColumn (const std::string &title)
int addRow (void)
void eraseRow (int row, int count=1) throw (std::runtime_error)
void insertData (int row, int col, double x, int wid=-1, int prec=-1) throw (std::runtime_error)
 Replace cell contents with formatted number.
void insertData (int row, int col, long x, int wid=-1, int radix=10) throw (std::runtime_error)
 Replace cell contents with formatted integer.
void insertData (int row, int col, const std::string &txt) throw (std::runtime_error)
 Replace cell contents with specified string.
void insertData (int row, int col, const object &obj) throw (std::runtime_error)
 Replace cell contents with specified data.
void insertRow (int row) throw (std::runtime_error)
 Add a row to the table.
Exceptions:
runtime_error exception will be thrown after creating a new row at the end of the table.

int getNRow (void) const
int getNColumn (void) const
cellrefHeader (int col) throw (std::runtime_error)
const cellrefHeader (int col) const throw (std::runtime_error)
cellrefCell (int row, int col) throw (std::runtime_error)
const cellrefCell (int row, int col) const throw (std::runtime_error)
void setBorder (bool On=true)


Detailed Description

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. brief Html Table object.
Author:
J. Zweizig
Version:
1.1; Modified May 2, 2001

Constructor & Destructor Documentation

html::table::table ( void   ) 

Construct an empty table. brief Default constructor.

html::table::table ( const std::string &  title  ) 

Construct an empty html table and set the title. brief Construct a table with a title

Parameters:
title Initial title string

html::table::table ( const table x  ) 

Construct an exact copy of the specified table. brief Copy constructor.

virtual html::table::~table ( void   )  [virtual]

Destroy the table. brief Table destructor.


Member Function Documentation

table* html::table::clone ( void   )  const [virtual]

Create an exact copy of the table. This implements the virtual html::object function. brief Clone a table.

Returns:
Pointer to a new table object.

Implements html::object.

table& html::table::operator= ( const table x  ) 

Set the table contents to that of the argument table. brief Table assignment operator.

Parameters:
x Table whose contents are to be copied.

void html::table::write ( writer out  )  const [virtual]

Write the table to an HTML document stream. brief Write the table to the HTML document.

Reimplemented from html::object.

int html::table::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. brief Add a column.

Parameters:
title Column title

int html::table::addRow ( void   ) 

Add an empty row to the end of the table. The row number is returned.

void html::table::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. brief Erase one or more rows.

Parameters:
row Number of first row to be erased
count Number of rows to be erased

void html::table::insertData ( int  row,
int  col,
double  x,
int  wid = -1,
int  prec = -1 
) throw (std::runtime_error)

Replace cell contents with formatted number.

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.

Parameters:
row Row number of cell
col Column number of cell
x Numeric value to be placed in cell.
wid Field width for integer.
prec Number of places after the decimal point.

void html::table::insertData ( int  row,
int  col,
long  x,
int  wid = -1,
int  radix = 10 
) throw (std::runtime_error)

Replace cell contents with formatted integer.

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.

Parameters:
row Row number of cell
col Column number of cell
x Integer value to be placed in cell.
wid Field width for integer.
radix Radix for integer.

void html::table::insertData ( int  row,
int  col,
const std::string &  txt 
) throw (std::runtime_error)

Replace cell contents with specified string.

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.

Parameters:
row Row number of cell
col Column number of cell
txt String to replace cell contents.

void html::table::insertData ( int  row,
int  col,
const object obj 
) throw (std::runtime_error)

Replace cell contents with specified data.

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.

Parameters:
row Row number of cell
col Column number of cell
obj Html object to replace cell contents.
Exceptions:
runtime_error 

void html::table::insertRow ( int  row  )  throw (std::runtime_error)

Add a row to the table.

Exceptions:
runtime_error exception will be thrown after creating a new row at the end of the table.

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

Parameters:
row Position to insert row.

int html::table::getNRow ( void   )  const [inline]

Get the current number of rows in the table. brief Get the number of rows.

Returns:
Number of rows in table.

int html::table::getNColumn ( void   )  const [inline]

Get the number of columns defined in the table. brief Get the number of columns.

Returns:
Number of columns in table.

html::cell & html::table::refHeader ( int  col  )  throw (std::runtime_error) [inline]

Get a reference to the header for the specified column. brief Get a column header reference.

Parameters:
col Column number.
Returns:
Reference to header cell of specified column.

const html::cell & html::table::refHeader ( int  col  )  const throw (std::runtime_error) [inline]

Get a constant reference to the header for the specified column. brief Get a column header reference.

Parameters:
col Column number.
Returns:
Constant reference to header cell of specified column.

html::cell & html::table::refCell ( int  row,
int  col 
) throw (std::runtime_error) [inline]

Get a reference to the cell at a specified location within the table. brief Get a specified cell reference.

Parameters:
row Row number
col Column number
Returns:
Reference to specified cell.

const html::cell & html::table::refCell ( int  row,
int  col 
) const throw (std::runtime_error) [inline]

Get a constant reference to the cell at a specified location within the table. brief Get a specified cell reference.

Parameters:
row Row number
col Column number
Returns:
Constant reference to specified cell.

void html::table::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. brief Enable/disable cell borders.


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:31 2009 for dmt by  doxygen 1.5.4