MCPcopy Create free account
hub / github.com/FreeFem/FreeFem-sources / addLogToHtml

Function addLogToHtml

etc/timer/parser.cpp:137–181  ·  view source on GitHub ↗

! * \brief Add formated log content to html file * \param input Log formatted content * \param htmlFile HTML output file */

Source from the content-addressed store, hash-verified

135 * \param htmlFile HTML output file
136 */
137void addLogToHtml(vector<string> *input, ofstream &htmlFile) {
138 if (!htmlFile || !input->size())
139 return;
140
141 vector<string>::iterator it = input->begin();
142
143 if (input->size() == 1) {
144 htmlFile << "<div class=\"" << getClass(*it) << "\">" << endl;
145 htmlFile << getInd(1) << "<p>" << getValue(*it) << "</p>" << endl;
146 htmlFile << "</div>" << endl;
147 return;
148 }
149
150 while((it != input->end()) && (getFlag(*it) == functionDefinition)) {
151 htmlFile << "<div class=\"" << getClass(*it) << "\">" << endl;
152 htmlFile << getInd(1) << "<p>" << getValue(*it) << "</p>" << endl;
153 it++;
154
155 flagsleft: {
156 if ((getFlag(*it) != typeDefinition) && (getFlag(*it) != parameterDefinition))
157 goto timeonly;
158
159 while ((it != input->end()) && ((getFlag(*it) == typeDefinition) || (getFlag(*it) == parameterDefinition))) {
160 htmlFile << getInd(1) << "<div class=\"" << getClass(*it) << "\">" << endl;
161 htmlFile << getInd(2) << "<p>" << getValue(*it) << "</p>" << endl;
162 it++;
163 while ((it < input->end()) && (getFlag(*it) == timeElapsed)) {
164 addTimeDiv(htmlFile, it, 2);
165 it++;
166 }
167 htmlFile << getInd(1) << "</div>" << endl;
168 }
169
170 timeonly: while ((it != input->end()) && (getFlag(*it) == timeElapsed)) {
171 addTimeDiv(htmlFile, it, 1);
172 it++;
173 }
174 }
175
176 if ((it != input->end()) && (getFlag(*it) != functionDefinition))
177 goto flagsleft;
178
179 htmlFile << "</div>" << endl;
180 }
181}
182
183/*!
184 * \brief Add div element containing time elapsed to html file

Callers 1

mainFunction · 0.85

Calls 8

getClassFunction · 0.85
getIndFunction · 0.85
getValueFunction · 0.85
getFlagFunction · 0.85
addTimeDivFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected