aboutsummaryrefslogtreecommitdiff
path: root/src/report/report-formatter-csv.cpp
AgeCommit message (Collapse)Author
2012-10-10Adding report generator facility (v2)Igor Zhbanov
This report generator adds the facility to generate correctly parsable reports in HTML and CSV format. It separates document structure from text formatting, enhances code readability and simplifies report generating. Also it makes possible adding other formats such as TXT or XML. This report generator implements the following document structure: body \---> section |---> header |---> paragraph \---> table \---> table row \---> table cell The report body consists of a number of sections (a.k.a. <div>s, a.k.a. tabs). Each section can contain headers (<h1>, <h2>, <h3>), paragraphs (<p>) and tables (<table>). A header is a single line of text. Paragraphs can contain only text. A table consists of table rows. A table row consists of table cells. A table cell can contain only text. Each section, table, row or cell could have its own formatting. To distinguish elements from others of its type, each element could have an unique identifier (see enums section_type, table_type, row_type and cell_type below). These identifiers are used in formatter implementations to produce special formatting. Example of usage: report_maker report(REPORT_OFF); report.set_type(REPORT_HTML); report.begin_section(); report.add_header("Big report"); report.begin_paragraph("Some text"); report.begin_table(); report.begin_row(); report.begin_cell(); report.add("Something"); report.begin_cell(CELL_SPECIAL); report.add("Foo bar"); report.finish_report(); const char *result = report.get_result();