Overpass API regression suite coverage (Nova Scotia) / overpass_api/statements/pivot.h

overpass_api/statements/pivot.h

15 of 19 instrumented lines run by the suite (78.9%) 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__AREA_QUERY_H
20#define DE__OSM3S___OVERPASS_API__STATEMENTS__AREA_QUERY_H
22#include <map>
23#include <string>
24#include <vector>
25#include "../data/utils.h"
26#include "statement.h"
29class Pivot_Statement : public Output_Statement
31 public:
32 Pivot_Statement(int line_number_, const std::map< std::string, std::string >& attributes,
33 Parsed_Query& global_settings);
34324 q virtual std::string get_name() const { return "pivot"; }
35 virtual void execute(Resource_Manager& rman);
36 virtual ~Pivot_Statement();
38 struct Statement_Maker : public Generic_Statement_Maker< Pivot_Statement >
39 {
402448612 q Statement_Maker() : Generic_Statement_Maker< Pivot_Statement >("pivot") {}
41 };
42 static Statement_Maker statement_maker;
44 struct Criterion_Maker : public Statement::Criterion_Maker
45 {
46164 q virtual bool can_standalone(const std::string& type) { return type == "node"; }
47 virtual Statement* create_criterion(const Token_Node_Ptr& tree_it,
48 const std::string& type, const std::string& into,
49 Statement::Factory& stmt_factory, Parsed_Query& global_settings, Error_Output* error_output);
502448612 q Criterion_Maker() { Statement::maker_by_ql_criterion()["pivot"] = this; }
51 };
52 static Criterion_Maker criterion_maker;
54 virtual Query_Constraint* get_query_constraint();
55124 q std::string get_input() const { return input; }
57 virtual std::string dump_xml(const std::string& indent) const
5944 q return indent + "<pivot"
6044 q + (input != "_" ? std::string(" from=\"") + input + "\"" : "")
6144 q + dump_xml_result_name() + "/>\n";
64 virtual std::string dump_compact_ql(const std::string&) const
650 {
660 return "node" + dump_ql_in_query("") + dump_ql_result_name() + ";";
670 }
68 virtual std::string dump_ql_in_query(const std::string&) const
7084 q return std::string("(pivot")
7184 q + (input != "_" ? std::string(".") + input : "")
7284 q + ")";
740 virtual std::string dump_pretty_ql(const std::string& indent) const { return indent + dump_compact_ql(indent); }
76 private:
77 std::string input;
78 std::vector< Query_Constraint* > constraints;
79};
81#endif