os_table


A table.

An os_table is a collection of tabular data organized as individual rows. Rows are added by inserting os_table_row objects using either the add() member function or operator<< .

The content of os_table_row objects determines the structure of an os_table . The number of columns within an os_table is typically equal to the number of cells in the os_table_row that contains the greatest number of cells.

The contents of an os_table_row object are constructed using either os_table_header or os_table_data . An os_table_header constructs a data cell that contains a table header. Table headers are typically rendered as bold and centered vertically and horizontally within the cell. An os_table_data constructs a data cell containing information that can be text, images, or other elements.

An os_table can optionally specify an os_caption in a constructor or through the caption() member function.

The overall width of an os_table can be specified in absolute pixels or as a percentage of the browser window through the width() member function. An os_table can specify the following characteristics for the cells within its rows.

Note that os_table , and all other table classes, support features proposed for HTML 3.0 and may not be supported by all browsers.

Declaration

#include <ospace/web/table.h>
class os_table : public os_element_group

Interface

Constructor
os_table()
Constructs an empty table.
Constructor
os_table( const os_element& element )
Constructs an empty table with a copy of element as its caption.
Constructor
os_table( const os_element& element , os_caption::alignment align )
Constructs an empty table with a copy of element as its caption, aligned according to align .
Constructor
os_table( const string& text )
Constructs an empty table with a copy of text as its caption.
Constructor
os_table( const string& text , os_caption::alignment align )
Constructs an empty table with a copy of text as its caption, aligned according to align .
Constructor
os_table( const os_caption& caption )
Constructs an empty table with a copy of caption as its caption.
Constructor
os_table( const os_table& rhs )
Constructs a table that is a copy of rhs .
Destructor
/* virtual */ ~os_table()
Destroys the table.
=
os_table& operator=( const os_table& rhs )
Replaces the contents of the table with a copy of rhs .
border
int border() const
Returns the table border thickness, or 0 if not set.
caption
os_table& caption( const string& caption )
Sets or replaces the table caption with a copy of text and returns a reference to the table.
caption
os_caption* caption() const
Returns a pointer to the caption, or 0 if not set.
caption
os_table& caption( const os_caption& caption )
Sets or replaces the table caption with a copy of caption and returns a reference to the table.
caption
os_table& caption( const os_element& element )
Sets or replaces the table caption with a copy of element and returns a reference to the table.
cell_padding
os_table& cell_padding( int padding )
Sets the cell padding to padding pixels and returns a reference to the table.
cell_padding
int cell_padding() const
Returns the cell padding in pixels, or 0 if not set.
cell_spacing
os_table& cell_spacing( int spacing )
Sets the cell spacing to spacing pixels and returns a reference to the table.
cell_spacing
int cell_spacing() const
Returns the cell spacing in pixels, or 0 if not set.
clone
/* virtual */ os_element* clone() const
Returns a base class pointer to a heap-based deep copy of the table.
noborder
os_table& noborder()
Disables the table border and returns a reference to the table.
print
/* virtual */ void print( ostream& os ) const
Prints the table to os .
report_constraint_violation
/* virtual */ void report_constraint_violation( const os_element& element , ostream& os ) const
Prints a constraint violation notice to os for element within the table.
width
int width() const
Returns the table width, or 0 if not set. If an absolute table width is set, the value returned represents the table width in pixels. If a relative table width is set, the value returned represents the table width as a percentage of the browser window.
width
os_table& width( const string& percent )
Sets the width of the table to a relative percent of the browser window, and returns a reference to the table.
width
os_table& width( int pixels )
Sets the width of the table to an absolute number of pixels , and returns a reference to the table.
width_as_string
string width_as_string() const
Returns the table width, or the empty string if not set. If the string returned ends with a percent sign, % , the value represents a relative table width as a percentage of the browser window. Otherwise, the string represents the absolute size of the table, in pixels.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved