#include <column_headers.h>
Inheritance diagram for column_headers:


Public Types | |
| enum | justifications { LEFT_JUSTIFY, CENTER_JUSTIFY, RIGHT_JUSTIFY } |
Public Member Functions | |
| column_headers () | |
| virtual | ~column_headers () |
| int | columns () const |
| returns the current number of columns in the header list. | |
| void | add (const istring &column_name, justifications placement=LEFT_JUSTIFY, int maximum_width=0) |
| adds a new column at the end of the list of columns with "column_name". | |
| bool | get (int index, istring &column_name, justifications &placement, int &maximum_width) |
| returns true if the column's info can be stuffed into the parameters. | |
| bool | zap (int start, int end=-1) |
| destroys the columns between "start" and "end". | |
| bool | format (istring &to_fill, const string_array &to_format) |
| applies our formatting to the array "to_format". | |
| bool | format (istring &to_fill, const string_matrix &to_format) |
| similar to the format() above, but operates on a matrix of strings. | |
| virtual void | pack (byte_array &packed_form) const |
| packs the column headers into the byte_array "packed_form". | |
| virtual bool | unpack (byte_array &packed_form) |
| unpacks the column headers from the byte_array "packed_form". | |
The column headers are managed here and allow a specification of maximum width, justification, and other properties of the column.
Definition at line 32 of file column_headers.h.
Definition at line 41 of file column_headers.h.
| column_headers::column_headers | ( | ) |
Definition at line 38 of file column_headers.cpp.
| column_headers::~column_headers | ( | ) | [virtual] |
| int column_headers::columns | ( | ) | const |
returns the current number of columns in the header list.
Definition at line 48 of file column_headers.cpp.
| void column_headers::add | ( | const istring & | column_name, | |
| justifications | placement = LEFT_JUSTIFY, |
|||
| int | maximum_width = 0 | |||
| ) |
adds a new column at the end of the list of columns with "column_name".
it's text justification will be "placement". if "maximum_width" is non-zero, then text printed to the column can only be that many characters or less.
Definition at line 52 of file column_headers.cpp.
| bool column_headers::get | ( | int | index, | |
| istring & | column_name, | |||
| justifications & | placement, | |||
| int & | maximum_width | |||
| ) |
returns true if the column's info can be stuffed into the parameters.
Definition at line 60 of file column_headers.cpp.
| bool column_headers::zap | ( | int | start, | |
| int | end = -1 | |||
| ) |
destroys the columns between "start" and "end".
if "end" is negative, then only the column at "start" is zapped. true is returned on success.
Definition at line 69 of file column_headers.cpp.
References columns(), and negative().
| bool column_headers::format | ( | istring & | to_fill, | |
| const string_array & | to_format | |||
| ) |
applies our formatting to the array "to_format".
returns true if the formatting of this set of column headers can be applied to the list of strings in "to_format". if successful, "to_fill" gets stuffed with a formatted line of text based on the column design. the method can fail if there are too many or too few headers for the list in "to_format". the "to_fill" string is appended to rather than overwritten.
Definition at line 79 of file column_headers.cpp.
References array< contents >::length().
| bool column_headers::format | ( | istring & | to_fill, | |
| const string_matrix & | to_format | |||
| ) |
similar to the format() above, but operates on a matrix of strings.
this allows the output in "to_fill" to be tailored to the available column widths; any column that was defined without a maximum width will be expanded as necessary. if any column that does have a maximum width's entries are smaller than the maximum, then the column width is shrunk appropriately.
Definition at line 87 of file column_headers.cpp.
References matrix< contents >::rows().
| void column_headers::pack | ( | byte_array & | packed_form | ) | const [virtual] |
packs the column headers into the byte_array "packed_form".
Implements packable.
Definition at line 95 of file column_headers.cpp.
References basis::attach(), and columns().
| bool column_headers::unpack | ( | byte_array & | packed_form | ) | [virtual] |
unpacks the column headers from the byte_array "packed_form".
Implements packable.
Definition at line 106 of file column_headers.cpp.
References basis::detach().
1.5.1