Overpass API regression suite coverage (Saxony) / overpass_api/frontend/web_output.cc
overpass_api/frontend/web_output.cc
13 of 142 instrumented lines run by the suite (9.2%) 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 modify6 * it under the terms of the GNU Affero General Public License as7 * published by the Free Software Foundation, either version 3 of the8 * 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 of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU Affero General Public License16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.17 */19#include "../../expat/escape_xml.h"20#include "output.h"21#include "web_output.h"23#include <iomanip>24#include <iostream>25#include <sstream>26#include <string>30void Web_Output::add_encoding_error(const std::string& error)42void Web_Output::add_parse_error(const std::string& error, int line_number)54void Web_Output::add_static_error(const std::string& error, int line_number)66void Web_Output::add_encoding_remark(const std::string& error)77void Web_Output::add_parse_remark(const std::string& error, int line_number)88void Web_Output::add_static_remark(const std::string& error, int line_number)99void Web_Output::runtime_error(const std::string& error)110void Web_Output::runtime_remark(const std::string& error)121void Web_Output::enforce_header(uint write_mime)128void Web_Output::write_html_header129 (const std::string& timestamp, const std::string& area_timestamp, uint write_mime, bool write_js_init,130 bool write_remarks)156void Web_Output::write_payload_header157 (const std::string& db_dir, const std::string& timestamp, const std::string& area_timestamp, bool write_mime)184// void Web_Output::write_json_header185// (const std::string& timestamp, const std::string& area_timestamp, bool write_mime)186// {187// if (header_written != not_yet)188// return;189// header_written = json;190//191// if (write_mime)192// {193// if (allow_headers != "")194// std::cout<<"Access-Control-Allow-Headers: "<<allow_headers<<'\n';195// if (has_origin)196// std::cout<<"Access-Control-Allow-Origin: *\n"197// "Access-Control-Max-Age: 600\n";198// if (http_method == http_options)199// std::cout<<"Access-Control-Allow-Methods: GET, POST, OPTIONS\n"200// "Content-Length: 0\n";201// std::cout<<"Content-type: application/json\n\n";202// if (http_method == http_options || http_method == http_head)203// return;204// }205//206// if (padding != "")207// std::cout<<padding<<"(";208//209// std::cout<<"{\n"210// " \"version\": 0.6,\n"211// " \"generator\": \"Overpass API\",\n"212// " \"osm3s\": {\n"213// " \"timestamp_osm_base\": \""<<timestamp<<"\",\n";214// if (area_timestamp != "")215// std::cout<<" \"timestamp_areas_base\": \""<<area_timestamp<<"\",\n";216// std::cout<<" \"copyright\": \"The data included in this document is from www.openstreetmap.org."217// " The data is made available under ODbL.\"\n"218// " },\n";219// std::cout<< " \"elements\": [\n\n";220// }223// void Web_Output::write_text_header224// (const std::string& timestamp, const std::string& area_timestamp, bool write_mime)225// {226// if (header_written != not_yet)227// return;228// header_written = text;229//230// if (write_mime)231// {232// if (allow_headers != "")233// std::cout<<"Access-Control-Allow-Headers: "<<allow_headers<<'\n';234// if (has_origin)235// std::cout<<"Access-Control-Allow-Origin: *\n"236// "Access-Control-Max-Age: 600\n";237// if (http_method == http_options)238// std::cout<<"Access-Control-Allow-Methods: GET, POST, OPTIONS\n"239// "Content-Length: 0\n";240// std::cout<<"Content-type: text/plain\n\n";241// if (http_method == http_options || http_method == http_head)242// return;243// }244//245// std::cout<<timestamp<<"\n";246// }249// void Web_Output::write_csv_header250// (const std::string& timestamp, const std::string& area_timestamp, bool write_mime)251// {252// if (header_written != not_yet)253// return;254// header_written = csv;255//256// if (write_mime)257// {258// if (allow_headers != "")259// std::cout<<"Access-Control-Allow-Headers: "<<allow_headers<<'\n';260// if (has_origin)261// std::cout<<"Access-Control-Allow-Origin: *\n";262// if (http_method == http_options)263// std::cout<<"Access-Control-Allow-Methods: GET, POST, OPTIONS\n"264// "Content-Length: 0\n";265// std::cout<<"Content-type: text/csv\n\n";266// if (http_method == http_options || http_method == http_head)267// return;268// }269// }272void Web_Output::write_footer()283void Web_Output::display_remark(const std::string& text)296void Web_Output::display_error(const std::string& text, uint write_mime)