Implements csv report functionality to add navigation and summary on the
csv report.
Signed-off-by: Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
src/report/report-formatter-csv.cpp | 22 ++++++++++++++++++++--
src/report/report-formatter-csv.h | 6 +++++-
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/report/report-formatter-csv.cpp b/src/report/report-formatter-csv.cpp
index bd9dfd3..2981940 100644
--- a/src/report/report-formatter-csv.cpp
+++ b/src/report/report-formatter-csv.cpp
@@ -189,10 +189,10 @@ report_formatter_csv::end_paragraph()
/* ************************************************************************ */
-std::string
+string
report_formatter_csv::escape_string(const char *str)
{
- std::string res;
+ string res;
assert(str);
@@ -261,3 +261,21 @@ report_formatter_csv::add_title(struct tag_attr *title_att, const
char *title)
add_exact("____________________________________________________________________\n");
addf_exact(" * * * %s * * *\n", title);
}
+
+void
+report_formatter_csv::add_navigation()
+{
+ /* No nav in csv - thinking on table of contents */
+}
+
+void
+report_formatter_csv::add_summary_list(string *list, int size)
+{
+ int i;
+ add_exact("\n");
+ for (i=0; i < size; i+=2){
+ addf_exact("%s %s,", list[i].c_str(), list[i+1].c_str());
+ }
+ add_exact("\n");
+}
+
diff --git a/src/report/report-formatter-csv.h b/src/report/report-formatter-csv.h
index 2c1c0fd..daf723e 100644
--- a/src/report/report-formatter-csv.h
+++ b/src/report/report-formatter-csv.h
@@ -42,6 +42,8 @@
/* Whether to escape with quotes empty cell values with spaces */
/*#define REPORT_CSV_SPACE_NEED_QUOTES*/
+using namespace std;
+
/* ************************************************************************ */
class report_formatter_csv: public report_formatter_string_base
@@ -78,13 +80,15 @@ public:
void add_div(struct tag_attr *div_attr);
void end_div();
void add_title(struct tag_attr *title_att, const char *title);
+ void add_navigation();
+ void add_summary_list(string *list, int size);
private:
void add_doc_header();
void add_quotes();
- std::string escape_string(const char *str);
+ string escape_string(const char *str);
bool csv_need_quotes;
size_t table_cell_number, text_start;
--
1.7.9.5