CMS 3D CMS Logo

DDHtmlFormatter.h
Go to the documentation of this file.
1 #ifndef DETECTOR_DESCRIPTION_REGRESSION_TEST_DD_HTML_FORMATTER_H
2 #define DETECTOR_DESCRIPTION_REGRESSION_TEST_DD_HTML_FORMATTER_H
3 
4 #include <iostream>
5 #include <string>
6 #include <sstream>
7 #include <map>
8 #include <set>
9 #include <vector>
10 
12 
13 class DDHtmlFormatter;
14 
15 std::ostream &operator<<(std::ostream &o, const DDHtmlFormatter &f);
16 
18 public:
19  typedef std::map<std::string, std::set<std::string> > ns_type;
20 
21  explicit DDHtmlFormatter() {}
23 
24  DDHtmlFormatter header(const std::string &text, const std::string &style = "../../style.css");
26 
28  pre();
29  os_ << "<br>" << std::endl;
30  return *this;
31  }
33  pre();
34  os_ << "<p>" << std::endl << content << std::endl << "</p>" << std::endl;
35  return *this;
36  }
37 
39  pre();
40  os_ << "<ul>" << std::endl;
41  return *this;
42  }
44  pre();
45  os_ << "<li>" << content << "</li>" << std::endl;
46  return *this;
47  }
49  pre();
50  os_ << "</ul>" << std::endl;
51  return *this;
52  }
53 
55  pre();
56  os_ << "<h1>" << content << "</h1>" << std::endl;
57  return *this;
58  }
60  pre();
61  os_ << "<h2>" << content << "</h2>" << std::endl;
62  return *this;
63  }
65  pre();
66  os_ << "<h3>" << content << "</h3>" << std::endl;
67  return *this;
68  }
69 
70  DDHtmlFormatter link(const std::string &url, const std::string &text, const std::string &target = "_self");
71  std::string lnk(const std::string &url, const std::string &text, const std::string &target = "_self");
72 
73  DDHtmlFormatter table(int border = 0) {
74  pre();
75  os_ << "<table border=\"" << border << "\">" << std::endl;
76  return *this;
77  }
79  pre();
80  os_ << "</table>" << std::endl;
81  return *this;
82  }
84  pre();
85  os_ << " <tr>" << std::endl;
86  return *this;
87  }
89  pre();
90  os_ << " </tr>" << std::endl;
91  return *this;
92  }
94  pre();
95  os_ << " <td>" << content << std::endl << " </td>" << std::endl;
96  return *this;
97  }
98 
99  DDHtmlFormatter color(int red, int green, int blue) { return *this; };
100 
101  void pre() { os_.str(""); }
102 
103  // std::string operator<<(std::string o) { o << os_; }
104  mutable std::stringstream os_;
105 
106  DDHtmlFormatter &operator=(const DDHtmlFormatter &) = delete;
107 };
108 
113 public:
114  DDNsGenerator(std::ostream &os,
115  const std::string &title,
116  const std::string &target,
117  const ns_type &n,
118  const std::string &text = "")
119  : os_(os), title_(title), text_(text), target_(target), n_(n) {}
120 
121  void doit();
122 
123 private:
124  std::ostream &os_;
126  const ns_type &n_;
127 };
128 
130 public:
131  DDFrameGenerator(std::ostream &os,
132  const std::string &title,
133  const std::string &n1 = "_ns", //frame names
134  const std::string &n2 = "_list",
135  const std::string &n3 = "_details",
136  const std::string &u1 = "ns.html", //url to be displayed in each frame
137  const std::string &u2 = "list.html",
138  const std::string &u3 = "details.html")
139  : t_(title), n1_(n1), n2_(n2), n3_(n3), u1_(u1), u2_(u2), u3_(u3), os_(os) {}
140 
141  void doit();
142 
143 private:
145  std::ostream &os_;
146 };
147 
149 public:
150  DDHtmlDetails(const std::string &cat, const std::string &txt);
151  virtual bool details(std::ostream &os, const DDName &) = 0;
152  virtual ns_type &names() = 0;
153  virtual ~DDHtmlDetails(){};
154  const std::string &category() { return cat_; }
155  const std::string &text() { return txt_; }
156 
157 protected:
158  mutable ns_type names_;
161 };
162 
164 public:
166  bool details(std::ostream &os, const DDName &) override;
167  ns_type &names() override;
168 };
169 
171 public:
173  bool details(std::ostream &os, const DDName &) override;
174  ns_type &names() override;
175 };
176 
178 public:
180  bool details(std::ostream &os, const DDName &) override;
181  ns_type &names() override;
182 };
183 
185 public:
187  bool details(std::ostream &os, const DDName &) override;
188  ns_type &names() override;
189 };
190 
192 public:
194  bool details(std::ostream &os, const DDName &) override;
195  ns_type &names() override;
196 };
197 
198 void dd_to_html(DDHtmlDetails &det);
199 
200 void dd_html_frameset(std::ostream &os);
201 
202 void dd_html_menu_frameset(std::ostream &os);
203 
204 void dd_html_menu(std::ostream &os);
205 
206 void dd_html_ro();
207 
208 #endif
dd_html_menu_frameset
void dd_html_menu_frameset(std::ostream &os)
DDHtmlFormatter::ulEnd
DDHtmlFormatter ulEnd()
Definition: DDHtmlFormatter.h:48
DDHtmlFormatter::h3
DDHtmlFormatter h3(const std::string &content)
Definition: DDHtmlFormatter.h:64
DDHtmlFormatter::p
DDHtmlFormatter p(const std::string &content)
Definition: DDHtmlFormatter.h:32
DDHtmlFormatter::DDHtmlFormatter
DDHtmlFormatter()
Definition: DDHtmlFormatter.h:21
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
relmon_authenticated_wget.url
url
Definition: relmon_authenticated_wget.py:22
DDHtmlFormatter
Definition: DDHtmlFormatter.h:17
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
DDHtmlRoDetails::DDHtmlRoDetails
DDHtmlRoDetails(const std::string &cat, const std::string &txt)
Definition: DDHtmlFormatter.h:186
DDFrameGenerator::doit
void doit()
Definition: DDHtmlFormatter.cc:335
DDHtmlLpDetails::details
bool details(std::ostream &os, const DDName &) override
Definition: DDHtmlFormatter.cc:222
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDFrameGenerator::t_
std::string t_
Definition: DDHtmlFormatter.h:144
DDHtmlMaDetails::DDHtmlMaDetails
DDHtmlMaDetails(const std::string &cat, const std::string &txt)
Definition: DDHtmlFormatter.h:172
DDHtmlLpDetails::names
ns_type & names() override
Definition: DDHtmlFormatter.cc:87
DDHtmlFormatter::lnk
std::string lnk(const std::string &url, const std::string &text, const std::string &target="_self")
Definition: DDHtmlFormatter.cc:54
DDNsGenerator::n_
const ns_type & n_
Definition: DDHtmlFormatter.h:126
DDHtmlFormatter::footer
DDHtmlFormatter footer()
Definition: DDHtmlFormatter.cc:62
DDHtmlDetails::txt_
std::string txt_
Definition: DDHtmlFormatter.h:159
eostools.cat
def cat(path)
Definition: eostools.py:401
DDHtmlFormatter::pre
void pre()
Definition: DDHtmlFormatter.h:101
dd_html_menu
void dd_html_menu(std::ostream &os)
DDHtmlDetails::cat_
std::string cat_
Definition: DDHtmlFormatter.h:159
DDHtmlRoDetails::names
ns_type & names() override
Definition: DDHtmlFormatter.cc:111
DDHtmlFormatter::br
DDHtmlFormatter br()
Definition: DDHtmlFormatter.h:27
DDNsGenerator
Definition: DDHtmlFormatter.h:112
DDHtmlFormatter::DDHtmlFormatter
DDHtmlFormatter(const DDHtmlFormatter &f)
Definition: DDHtmlFormatter.h:22
dd_html_frameset
void dd_html_frameset(std::ostream &os)
DDNsGenerator::target_
std::string target_
Definition: DDHtmlFormatter.h:125
DDHtmlMaDetails::names
ns_type & names() override
Definition: DDHtmlFormatter.cc:93
DDNsGenerator::DDNsGenerator
DDNsGenerator(std::ostream &os, const std::string &title, const std::string &target, const ns_type &n, const std::string &text="")
Definition: DDHtmlFormatter.h:114
DDHtmlDetails::names
virtual ns_type & names()=0
dd_to_html
void dd_to_html(DDHtmlDetails &det)
Definition: DDHtmlFormatter.cc:282
DDNsGenerator::os_
std::ostream & os_
Definition: DDHtmlFormatter.h:124
DDFrameGenerator::n2_
std::string n2_
Definition: DDHtmlFormatter.h:144
operator<<
std::ostream & operator<<(std::ostream &o, const DDHtmlFormatter &f)
DDHtmlSoDetails::DDHtmlSoDetails
DDHtmlSoDetails(const std::string &cat, const std::string &txt)
Definition: DDHtmlFormatter.h:179
DivergingColor.red
list red
Definition: DivergingColor.py:172
DDHtmlSpDetails
Definition: DDHtmlFormatter.h:191
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
DDHtmlFormatter::li
DDHtmlFormatter li(const std::string &content)
Definition: DDHtmlFormatter.h:43
DDHtmlFormatter::color
DDHtmlFormatter color(int red, int green, int blue)
Definition: DDHtmlFormatter.h:99
ns_type
std::map< std::string, std::set< std::string > > ns_type
Definition: DDErrorDetection.h:33
DDHtmlFormatter::os_
std::stringstream os_
Definition: DDHtmlFormatter.h:104
DDHtmlLpDetails
Definition: DDHtmlFormatter.h:163
DDHtmlFormatter::operator=
DDHtmlFormatter & operator=(const DDHtmlFormatter &)=delete
DDHtmlDetails::category
const std::string & category()
Definition: DDHtmlFormatter.h:154
DDHtmlRoDetails::details
bool details(std::ostream &os, const DDName &) override
Definition: DDHtmlFormatter.cc:129
str
#define str(s)
Definition: TestProcessor.cc:52
DDHtmlDetails::text
const std::string & text()
Definition: DDHtmlFormatter.h:155
DDHtmlFormatter::link
DDHtmlFormatter link(const std::string &url, const std::string &text, const std::string &target="_self")
Definition: DDHtmlFormatter.cc:48
style
Definition: style.py:1
dd_html_ro
void dd_html_ro()
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDHtmlFormatter::ul
DDHtmlFormatter ul()
Definition: DDHtmlFormatter.h:38
DDHtmlSpDetails::DDHtmlSpDetails
DDHtmlSpDetails(const std::string &cat, const std::string &txt)
Definition: DDHtmlFormatter.h:193
Skims_PA_cff.content
content
Definition: Skims_PA_cff.py:19
DDHtmlMaDetails::details
bool details(std::ostream &os, const DDName &) override
Definition: DDHtmlFormatter.cc:155
DDHtmlDetails::DDHtmlDetails
DDHtmlDetails(const std::string &cat, const std::string &txt)
Definition: DDHtmlFormatter.cc:85
DDNsGenerator::text_
std::string text_
Definition: DDHtmlFormatter.h:125
DDFrameGenerator::u2_
std::string u2_
Definition: DDHtmlFormatter.h:144
DDFrameGenerator::n1_
std::string n1_
Definition: DDHtmlFormatter.h:144
DDHtmlFormatter::tableEnd
DDHtmlFormatter tableEnd()
Definition: DDHtmlFormatter.h:78
testProducerWithPsetDescEmpty_cfi.u3
u3
Definition: testProducerWithPsetDescEmpty_cfi.py:50
testProducerWithPsetDescEmpty_cfi.u1
u1
Definition: testProducerWithPsetDescEmpty_cfi.py:49
DDHtmlFormatter::td
DDHtmlFormatter td(const std::string &content)
Definition: DDHtmlFormatter.h:93
DivergingColor.blue
list blue
Definition: DivergingColor.py:173
DDHtmlSoDetails::details
bool details(std::ostream &os, const DDName &) override
Definition: DDHtmlFormatter.cc:117
DDHtmlSoDetails
Definition: DDHtmlFormatter.h:177
DDHtmlRoDetails
Definition: DDHtmlFormatter.h:184
DDHtmlDetails::~DDHtmlDetails
virtual ~DDHtmlDetails()
Definition: DDHtmlFormatter.h:153
DDHtmlFormatter::header
DDHtmlFormatter header(const std::string &text, const std::string &style="../../style.css")
Definition: DDHtmlFormatter.cc:40
DDHtmlFormatter::trEnd
DDHtmlFormatter trEnd()
Definition: DDHtmlFormatter.h:88
DDHtmlDetails::details
virtual bool details(std::ostream &os, const DDName &)=0
DDFrameGenerator::DDFrameGenerator
DDFrameGenerator(std::ostream &os, const std::string &title, const std::string &n1="_ns", const std::string &n2="_list", const std::string &n3="_details", const std::string &u1="ns.html", const std::string &u2="list.html", const std::string &u3="details.html")
Definition: DDHtmlFormatter.h:131
DDHtmlSpDetails::details
bool details(std::ostream &os, const DDName &) override
Definition: DDHtmlFormatter.cc:123
DDHtmlSpDetails::names
ns_type & names() override
Definition: DDHtmlFormatter.cc:105
DDErrorDetection.h
DDHtmlFormatter::ns_type
std::map< std::string, std::set< std::string > > ns_type
Definition: DDHtmlFormatter.h:19
DDHtmlFormatter::tr
DDHtmlFormatter tr()
Definition: DDHtmlFormatter.h:83
DDHtmlFormatter::table
DDHtmlFormatter table(int border=0)
Definition: DDHtmlFormatter.h:73
DDHtmlDetails::names_
ns_type names_
Definition: DDHtmlFormatter.h:158
DDHtmlSoDetails::names
ns_type & names() override
Definition: DDHtmlFormatter.cc:99
DDHtmlDetails
Definition: DDHtmlFormatter.h:148
DDHtmlMaDetails
Definition: DDHtmlFormatter.h:170
DDFrameGenerator
Definition: DDHtmlFormatter.h:129
DDHtmlFormatter::h2
DDHtmlFormatter h2(const std::string &content)
Definition: DDHtmlFormatter.h:59
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
DDFrameGenerator::u3_
std::string u3_
Definition: DDHtmlFormatter.h:144
DDFrameGenerator::os_
std::ostream & os_
Definition: DDHtmlFormatter.h:145
DDHtmlDetails::f_
DDHtmlFormatter f_
Definition: DDHtmlFormatter.h:160
runonSM.text
text
Definition: runonSM.py:43
DDHtmlLpDetails::DDHtmlLpDetails
DDHtmlLpDetails(const std::string &cat, const std::string &txt)
Definition: DDHtmlFormatter.h:165
DDHtmlFormatter::h1
DDHtmlFormatter h1(const std::string &content)
Definition: DDHtmlFormatter.h:54
DDFrameGenerator::u1_
std::string u1_
Definition: DDHtmlFormatter.h:144
MetAnalyzer.u2
u2
Definition: MetAnalyzer.py:61
DDFrameGenerator::n3_
std::string n3_
Definition: DDHtmlFormatter.h:144
DDNsGenerator::title_
std::string title_
Definition: DDHtmlFormatter.h:125
DDNsGenerator::doit
void doit()
Definition: DDHtmlFormatter.cc:71