218 |
|
|
219 |
|
ostream& operator<<(ostream& os, Page& data) |
220 |
|
{ |
221 |
< |
string address = data.getAddress(); |
221 |
> |
string address(data.getAddress()); |
222 |
|
|
223 |
|
entities(address, '&', "&"); |
224 |
|
entities(address, '<', "<"); |
225 |
|
entities(address, '>', ">"); |
226 |
|
|
227 |
< |
os << " <page>\n" << " <address>" << address << "</address>\n"; |
227 |
> |
os << "\t<page>\n" << "\t\t<address>" << address << "</address>\n"; |
228 |
|
|
229 |
|
#ifndef _OpenSSL_ |
230 |
|
if (data.getPort() != 80) |
233 |
|
data.getTls())) |
234 |
|
#endif |
235 |
|
{ |
236 |
< |
os << " <port>" << data.getPort() << "</port>\n"; |
236 |
> |
os << "\t\t<port>" << data.getPort() << "</port>\n"; |
237 |
|
} |
238 |
|
|
239 |
|
#ifdef _OpenSSL_ |
240 |
|
os.setf(ios::boolalpha); |
241 |
< |
os << " <tls>" << data.getTls() << "</tls>\n"; |
241 |
> |
|
242 |
> |
os << "\t\t<tls>" << data.getTls() << "</tls>\n"; |
243 |
|
#endif |
244 |
|
|
245 |
< |
string path = data.getPath(); |
245 |
> |
string path(data.getPath()); |
246 |
|
|
247 |
|
entities(path, '&', "&"); |
248 |
|
entities(path, '<', "<"); |
249 |
|
entities(path, '>', ">"); |
250 |
|
|
251 |
< |
os << " <path>" << path << "</path>\n"; |
252 |
< |
|
252 |
< |
os << " <size>" << data.getSize() << "</size>\n"; |
251 |
> |
os << "\t\t<path>" << path << "</path>\n\t\t<size>" << data.getSize() |
252 |
> |
<< "</size>\n"; |
253 |
|
|
254 |
< |
if(data.getTitle() != "") |
254 |
> |
if(!data.getTitle().empty()) |
255 |
|
{ |
256 |
< |
string title = data.getTitle(); |
256 |
> |
string title(data.getTitle()); |
257 |
|
|
258 |
|
entities(title, '&', "&"); |
259 |
|
entities(title, '<', "<"); |
260 |
|
entities(title, '>', ">"); |
261 |
|
|
262 |
< |
os << " <title>" << title << "</title>\n"; |
262 |
> |
os << "\t\t<title>" << title << "</title>\n"; |
263 |
|
} |
264 |
|
|
265 |
< |
if(data.getDescription() != "") |
265 |
> |
if(!data.getDescription().empty()) |
266 |
|
{ |
267 |
< |
string description = data.getDescription(); |
267 |
> |
string description(data.getDescription()); |
268 |
|
|
269 |
|
entities(description, '&', "&"); |
270 |
|
entities(description, '<', "<"); |
271 |
|
entities(description, '>', ">"); |
272 |
|
|
273 |
< |
os << " <description>" << description << "</description>\n"; |
273 |
> |
os << "\t\t<description>" << description << "</description>\n"; |
274 |
|
} |
275 |
|
|
276 |
< |
string text = data.getText(); |
276 |
> |
string text(data.getText()); |
277 |
|
|
278 |
|
entities(text, '&', "&"); |
279 |
|
entities(text, '<', "<"); |
280 |
|
entities(text, '>', ">"); |
281 |
|
|
282 |
< |
os << " <text>" << text << "</text>\n"; |
282 |
> |
os << "\t\t<text>" << text << "</text>\n"; |
283 |
|
|
284 |
|
for (size_t index(0); index < data.getHeadings().size(); index++) |
285 |
|
{ |
286 |
< |
string heading = data.getHeadings()[index]; |
286 |
> |
string heading(data.getHeadings()[index]); |
287 |
|
|
288 |
|
entities(heading, '&', "&"); |
289 |
|
entities(heading, '<', "<"); |
290 |
|
entities(heading, '>', ">"); |
291 |
|
|
292 |
< |
os << " <heading>" << heading << "</heading>\n"; |
292 |
> |
os << "\t\t<heading>" << heading << "</heading>\n"; |
293 |
|
} |
294 |
|
|
295 |
< |
os << " </page>"; |
295 |
> |
os << "\t</page>"; |
296 |
|
|
297 |
|
return os; |
298 |
|
} |