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