#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
int | MakeDeanHTML (std::string const &InFileName, std::string const &OutFileName) |
|
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
int MakeDeanHTML |
( |
std::string const & |
InFileName, |
|
|
std::string const & |
OutFileName |
|
) |
| |
Definition at line 51 of file MakeDeanHTML.cc.
References ecal_dqm_sourceclient-live_cfg::cerr, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by main().
54 std::ifstream InFile(InFileName.c_str());
55 if (!InFile.is_open()) {
56 std::cerr <<
"ERROR: cannot open input file" << std::endl;
61 std::ofstream OutFile(OutFileName.c_str());
62 if (!OutFile.is_open()) {
63 std::cerr <<
"ERROR: cannot open output file" << std::endl;
68 OutFile <<
"<html>\n<body>\n\n";
72 std::getline(InFile, FirstLine);
73 std::istringstream LineStream;
74 LineStream.str(FirstLine);
76 std::vector<std::string> Widths;
77 while (LineStream >> Width) {
78 Widths.push_back(Width);
80 while (InFile.peek() ==
'#') {
81 std::getline(InFile, FirstLine);
82 OutFile <<
std::string(FirstLine.begin()+1, FirstLine.end()) << std::endl;
85 OutFile <<
"<hr>\n<table>\n\n";
87 while (!InFile.eof()) {
90 for (
size_t iCol = 0; iCol != Widths.size(); ++iCol) {
91 std::getline(InFile, OneLine);
92 bool const BlankLine = OneLine ==
"" ?
true :
false;
94 OutFile <<
" <td width=\"" << Widths[iCol] <<
"\">\n";
96 std::string const PlotName(OneLine.begin(), OneLine.begin()+OneLine.find(
":"));
97 std::string const ThumbName =
std::string(PlotName.begin(), PlotName.begin() + PlotName.find(
".gif")) +
"_small.gif";
98 std::string const Caption(OneLine.begin()+OneLine.find(
":")+1, OneLine.end());
99 OutFile <<
" <center>\n";
100 OutFile <<
" <a href=\"" << PlotName <<
"\">\n";
101 OutFile <<
" <img src=\"" << ThumbName <<
"\">\n";
102 OutFile <<
" </a><br>\n";
103 OutFile <<
" " << Caption <<
"\n";
104 OutFile <<
" </center>\n";
106 OutFile <<
" </td>\n";
108 OutFile <<
" </tr>\n\n";
110 std::getline(InFile, OneLine);
113 OutFile <<
"</table>\n\n</body>\n</html>";