forked from WieheLab/ARMADiLLO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTML.cpp
More file actions
107 lines (95 loc) · 2.79 KB
/
HTML.cpp
File metadata and controls
107 lines (95 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <map>
#include "HTML.hpp"
using namespace std;
//Td
Td::Td(string _hclass, string _style, string _id, string _colspan, string _value)
{
hclass=_hclass;
style=_style;
id=_id;
colspan=_colspan;
value=_value;
}
void Td::print(string &file_string)
{
file_string+=" <td";
if (!hclass.empty()){file_string+=" class=\""+hclass+"\"";}
if (!style.empty()){file_string+=" style=\""+style+"\"";}
if (!id.empty()){file_string+=" id=\""+id+"\"";}
if (!colspan.empty()){file_string+=" colspan=\""+colspan+"\"";}
if (!rowspan.empty()){file_string+=" rowspan=\""+rowspan+"\"";}
if (!valign.empty()){file_string+=" valign=\""+valign+"\"";}
if (!div_class.empty()){file_string+="><div class=\""+div_class+"\"";}
file_string+=">"+value;
if (!div_class.empty()){file_string+="</div>";}
file_string+="</td>\n";
}
//Tr
Tr::Tr(string _hclass, string _style, string _id, vector<Td> _cols)
{
hclass=_hclass;
style=_style;
id=_id;
cols=_cols;
}
void Tr::print(string &file_string)
{
file_string+=" <tr";
if (!hclass.empty()){file_string+=" class=\""+hclass+"\"";}
if (!style.empty()){file_string+=" style=\""+style+"\"";}
if (!id.empty()){file_string+=" id=\""+id+"\"";}
file_string+=">\n";
for(int i=0; i<cols.size(); i++)
{
cols[i].print(file_string);
}
file_string+=" </tr>\n";
}
//Table
Table::Table(string _hclass, string _style, string _id, vector<Tr> _rows)
{
hclass=_hclass;
style=_style;
id=_id;
rows=_rows;
}
void Table::print(string &file_string)
{
file_string+="<table";
if (!hclass.empty()){file_string+=" class=\""+hclass+"\"";}
if (!style.empty()){file_string+=" style=\""+style+"\"";}
if (!id.empty()){file_string+=" id=\""+id+"\"";}
file_string+=">";
for(int i=0; i<rows.size(); i++)
{
rows[i].print(file_string);
}
file_string+="</table>\n";
}
bool writeError(string filename, string seqName)
{
string outString;
outString+="<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>\n";
outString+="<head>\n";
outString+="<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n";
outString+="<title>Antibody Mutation Analysis</title>\n";
outString+="<link rel='stylesheet' href='AMA.css' />\n";
outString+="</head>\n";
outString+="<body>\n";
outString+="<br><br><div align=\"center\"><font size=6><b>\n";
outString+= "Unidentified nucleotide in sequence: "+seqName+" <br>\n";
outString+="ARMADiLLO cannot accept amino acid sequences or nucleotide sequences with ambuguity codes\n<br>\n";
outString+="</font>\n</b>\n</div>\n</body>\n</html>";
ofstream file_out;
file_out.open(filename.c_str());
file_out << outString;
file_out.close();
return true;
}