Overpass API regression suite coverage (Saxony) / overpass_api/statements/filter.h
overpass_api/statements/filter.h
13 of 14 instrumented lines run by the suite (92.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 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#ifndef DE__OSM3S___OVERPASS_API__STATEMENTS__FILTER_H20#define DE__OSM3S___OVERPASS_API__STATEMENTS__FILTER_H22#include <map>23#include <string>24#include <vector>25#include "statement.h"26#include "tag_value.h"29/* === The Query Filter ===31The query filter can be added as condition to a query statement.32It has an evaluator as argument33and it lets pass only those elements for which the expression returns boolean true.35At the moment, the query filter cannot be the only condition in a query.36This is due to implementation reasons and will change in future versions.38It is technically possible to have multiple query filters in a single query.39But it does not make sense:40Their evaulators can be combined with a conjunction in a single query filter.41This has the same semantics and is faster.43Its syntax is45 (if: <Evaluator>)47The whitespace is optional.48*/50class Filter_Statement : public Output_Statement51{52 public:53 Filter_Statement(int line_number_, const std::map< std::string, std::string >& attributes,54 Parsed_Query& global_settings);56 virtual void add_statement(Statement* statement, std::string text);57 virtual void execute(Resource_Manager& rman);58 virtual ~Filter_Statement();60 struct Statement_Maker : public Generic_Statement_Maker< Filter_Statement >61 {63 };64 static Statement_Maker statement_maker;66 struct Criterion_Maker : public Statement::Criterion_Maker67 {69 virtual Statement* create_criterion(const Token_Node_Ptr& tree_it,70 const std::string& type, const std::string& into,71 Statement::Factory& stmt_factory, Parsed_Query& global_settings, Error_Output* error_output);73 };74 static Criterion_Maker criterion_maker;76 virtual Query_Constraint* get_query_constraint();80 virtual std::string dump_xml(const std::string& indent) const87 virtual std::string dump_compact_ql(const std::string&) const910 virtual std::string dump_pretty_ql(const std::string& indent) const { return dump_compact_ql(indent); }93 private:94 std::vector< Query_Constraint* > constraints;95 Evaluator* criterion;96};99#endif