Overpass API regression suite coverage (Saxony) / overpass_api/frontend/web_output.h

overpass_api/frontend/web_output.h

5 of 9 instrumented lines run by the suite (55.6%) 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#ifndef DE__OSM3S___OVERPASS_API__FRONTEND__WEB_OUTPUT_H
20#define DE__OSM3S___OVERPASS_API__FRONTEND__WEB_OUTPUT_H
23#include "../core/datatypes.h"
24#include "basic_formats.h"
25#include "output_handler.h"
28struct Web_Output : public Error_Output
30673673 q Web_Output(uint log_level_) : http_method(http_get), has_origin(false), header_written(not_yet),
31673673 q encoding_errors(false), parse_errors(false), static_errors(false), log_level(log_level_),
32673673 q output_handler(0) {}
34673673 q ~Web_Output() { write_footer(); }
36 virtual void add_encoding_error(const std::string& error);
37 virtual void add_parse_error(const std::string& error, int line_number);
38 virtual void add_static_error(const std::string& error, int line_number);
40 virtual void add_encoding_remark(const std::string& error);
41 virtual void add_parse_remark(const std::string& error, int line_number);
42 virtual void add_static_remark(const std::string& error, int line_number);
44 virtual void runtime_error(const std::string& error);
45 virtual void runtime_remark(const std::string& error);
47 virtual void display_statement_progress
48 (uint timer, const std::string& name, int progress, int line_number,
490 const std::vector< std::pair< uint, uint > >& stack) {}
510 virtual bool display_encoding_errors() { return encoding_errors; }
520 virtual bool display_parse_errors() { return parse_errors; }
530 virtual bool display_static_errors() { return static_errors; }
55 void enforce_header(uint write_mime);
56 void write_html_header
57 (const std::string& timestamp = "", const std::string& area_timestamp = "", uint write_mime = 200,
58 bool write_js_init = false, bool write_remarks = true);
59 void write_payload_header
60 (const std::string& db_dir, const std::string& timestamp, const std::string& area_timestamp,
61 bool write_mime);
62 void write_footer();
64673673 q void set_output_handler(Output_Handler* output_handler_) { output_handler = output_handler_; }
66public:
67 Http_Methods http_method;
68 std::string allow_headers;
69 bool has_origin;
71private:
72 enum { not_yet, payload, html, final } header_written;
73 bool encoding_errors;
74 bool parse_errors;
75 bool static_errors;
76 uint log_level;
77 std::string messages;
79 Output_Handler* output_handler;
81 void display_remark(const std::string& text);
82 void display_error(const std::string& text, uint write_mime);
83};
86#endif