Overpass API regression suite coverage (Saxony) / overpass_api/statements/statement_dump.h

overpass_api/statements/statement_dump.h

3 of 4 instrumented lines run by the suite (75.0%) 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__STATEMENTS__STATEMENT_DUMP_H
20#define DE__OSM3S___OVERPASS_API__STATEMENTS__STATEMENT_DUMP_H
23#include "statement.h"
25#include <map>
26#include <string>
27#include <vector>
30/**
31 * The base class for all statements
32 */
33class Statement_Dump
35 public:
36 struct Factory
37 {
382076692 q Factory(Statement::Factory& stmt_factory_) : bbox_limitation(0), stmt_factory(&stmt_factory_) {}
40 Statement_Dump* create_statement(std::string element, int line_number,
41 const std::map< std::string, std::string >& attributes);
42 Statement_Dump* create_evaluator(const Token_Node_Ptr& tree_it, Statement::QL_Context tree_context,
43 const Statement::Return_Type_Checker& eval_type);
44 Statement_Dump* create_criterion(const Token_Node_Ptr& tree_it,
45 const std::string& type, bool& can_standalone, const std::string& into);
47 int bbox_limitation;
48 Statement::Factory* stmt_factory;
49 };
51 Statement_Dump(std::string name, const std::map< std::string, std::string >& attributes_, int line_number_,
52 Statement* stmt = 0)
5325818692 q : name_(name), attributes(attributes_), line_number(line_number_), non_dump_stmt(stmt) {}
54 ~Statement_Dump();
56 void add_statement(Statement_Dump* statement, std::string text);
57 std::string dump_xml() const;
58 std::string dump_pretty_map_ql(Statement::Factory& stmt_factory);
59 std::string dump_compact_map_ql(Statement::Factory& stmt_factory);
60 std::string dump_bbox_map_ql(Statement::Factory& stmt_factory);
620 const std::string& name() const { return name_; }
63 std::string attribute(const std::string& key) const;
651477 q void add_final_text(std::string text) {}
67 Statement* create_non_dump_stmt(Statement::Factory& stmt_factory);
69 private:
70 std::string name_;
71 std::map< std::string, std::string > attributes;
72 std::vector< Statement_Dump* > substatements;
73 int line_number;
74 Statement* non_dump_stmt;
75};
77#endif