CbmRoot
Loading...
Searching...
No Matches
CbmHtmlReportElement.cxx
Go to the documentation of this file.
1/* Copyright (C) 2011-2020 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev, Andrey Lebedev [committer] */
4
11
12#include <sstream> // for operator<<, string, basic_ostream
13#include <string> // for char_traits, operator+
14
15using std::endl;
16using std::string;
17using std::stringstream;
18using std::vector;
19
21
23
24string CbmHtmlReportElement::TableBegin(const string& caption, const vector<string>& colNames) const
25{
26 stringstream ss;
27 ss << "<h2>" << caption << "</h2>";
28 ss << "<table id=\"efficiency\" >" << endl;
29 ss << "<tr>";
30 for (unsigned int i = 0; i < colNames.size(); i++) {
31 ss << "<th>" << colNames[i] << "</th>";
32 }
33 ss << "</tr>" << endl;
34 return ss.str();
35}
36
37string CbmHtmlReportElement::TableEnd() const { return "</table>"; }
38
39string CbmHtmlReportElement::TableEmptyRow(int nofCols, const string& name) const
40{
41 stringstream ss;
42 ss << "<td colspan=\"" << nofCols << "\"><center><b>" << name << "</b></center></td></tr>" << endl;
43 return ss.str();
44}
45
46string CbmHtmlReportElement::TableRow(const vector<string>& row) const
47{
48 string st = "<tr>";
49 for (unsigned int i = 0; i < row.size(); i++) {
50 st += "<td>" + row[i] + "</td>";
51 }
52 st += "</tr> \n";
53 return st;
54}
55
56string CbmHtmlReportElement::Image(const string& title, const string& file) const
57{
58 stringstream ss;
59 ss << "<h3>" << title << "</h3>";
60 ss << "<img src=\"" << file << ".png\" alt=\"" << title << "\" />";
61
62 return ss.str();
63}
64
66{
67 string str = "<html><body><head><style type=\"text/css\">";
68 str += "#efficiency";
69 str += "{";
70 str += "font-family:Verdana, Arial, Helvetica, sans-serif;";
71 // str += "width:100%;";
72 str += "border-collapse:collapse;";
73 str += "}";
74 str += "#efficiency td, #efficiency th";
75 str += "{";
76 str += "font-size:1em;";
77 str += "border:1px solid #98bf21;";
78 str += "padding:3px 7px 2px 7px;";
79 str += "}";
80 str += "#efficiency th";
81 str += "{";
82 str += "font-size:1.1em;";
83 str += "text-align:left;";
84 str += "padding-top:5px;";
85 str += "padding-bottom:4px;";
86 str += "background-color:#A7C942;";
87 str += "color:#ffffff;";
88 str += "}";
89 str += "#efficiency tr.alt td";
90 str += "{";
91 str += "color:#000000;";
92 str += "background-color:#EAF2D3;";
93 str += "}";
94 str += "</style></head>";
95 return str;
96}
97
98string CbmHtmlReportElement::DocumentEnd() const { return "</body></html>"; }
99
100string CbmHtmlReportElement::Title(int size, const string& title) const
101{
102 stringstream ss;
103 ss << "<h" << size + 1 << ">" << title << "</h" << size + 1 << ">";
104 return ss.str();
105}
106
ClassImp(CbmConverterManager)
Implementation of CbmReportElement for HTML output.
static constexpr size_t size()
Definition KfSimdPseudo.h:2
Implementation of CbmReportElement for text output.
virtual std::string TableEnd() const
Inherited from CbmReportElement.
virtual std::string DocumentEnd() const
Inherited from CbmReportElement.
virtual std::string TableRow(const std::vector< std::string > &row) const
Inherited from CbmReportElement.
virtual std::string TableEmptyRow(int nofCols, const std::string &name) const
Inherited from CbmReportElement.
virtual std::string Image(const std::string &title, const std::string &file) const
Inherited from CbmReportElement.
virtual std::string TableBegin(const std::string &caption, const std::vector< std::string > &colNames) const
Inherited from CbmReportElement.
virtual std::string Title(int size, const std::string &title) const
Inherited from CbmReportElement.
virtual ~CbmHtmlReportElement()
Destructor.
virtual std::string DocumentBegin() const
Inherited from CbmReportElement.