Overpass API regression suite coverage (Nova Scotia) / overpass_api/frontend/basic_formats.cc

overpass_api/frontend/basic_formats.cc

27 of 43 instrumented lines run by the suite (62.8%) at 8edf11b0419c (this file on GitHub).

runnever runcolumns: line, executions, queries (click for the queries that run the line)

1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.
2 *
3 * This file is part of Overpass_API.
4 *
5 * Overpass_API is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * Overpass_API is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.
17 */
19#include "../core/datatypes.h"
20#include "basic_formats.h"
23#include <string>
26std::string iso_string(uint64 timestamp)
271433640 q{
281433640 q return Timestamp(timestamp).str();
291433640 q}
32void write_html_header
33 (const std::string& timestamp, const std::string& area_timestamp, uint write_mime, bool write_js_init,
34 bool write_remarks)
3611 q if (write_mime > 0)
3811 q if (write_mime != 200)
390 {
400 if (write_mime == 504)
410 std::cout<<"Status: "<<write_mime<<" Gateway Timeout\n";
420 else if (write_mime == 400)
430 std::cout<<"Status: "<<write_mime<<" Bad Request\n";
440 else if (write_mime == 429)
450 std::cout<<"Status: "<<write_mime<<" Too Many Requests\n";
460 else
470 std::cout<<"Status: "<<write_mime<<"\n";
480 }
4911 q std::cout<<"Content-type: text/html; charset=utf-8\n\n";
5111 q std::cout<<
5211 q "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
5311 q "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
5411 q " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
5511 q "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"
5611 q "<head>\n"
5711 q " <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" lang=\"en\"/>\n"
5811 q " <title>OSM3S Response</title>\n"
5911 q "</head>\n";
6011 q std::cout<<(write_js_init ? "<body onload=\"init()\">\n\n" : "<body>\n\n");
6111 q if (write_remarks)
6311 q std::cout<<
6411 q "<p>The data included in this document is from www.openstreetmap.org. "
6511 q "The data is made available under ODbL.</p>\n";
6611 q if (timestamp != "")
670 {
680 std::cout<<"<p>Data included until: "<<timestamp;
690 if (area_timestamp != "")
700 std::cout<<"<br/>Areas based on data until: "<<area_timestamp;
710 std::cout<<"</p>\n";
720 }