Overpass API regression suite coverage (Saxony) / overpass_api/statements/complete.h
overpass_api/statements/complete.h
22 of 31 instrumented lines run by the suite (71.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 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__COMPLETE_H20#define DE__OSM3S___OVERPASS_API__STATEMENTS__COMPLETE_H22#include <map>23#include <string>24#include <vector>26#include "../data/utils.h"27#include "statement.h"30/* === The block statement <em>complete</em> ===32''since v0.7.55''34The block statement <em>complete</em> loops through its substatements35until the results of the loop stabilize.36This allows to track a group of loosely or tightly connected elements37like all sections of a way with the same name or a system of tributary rivers.39The statement delivers the accumulated elements in its output set40both at the beginning of each loop execution and as output of the whole statement.42The elements are accumulated from the input set before entering the loop43and again from the input set at the end of the loop.44If the input set contains extra elements then the loop is executed again.46The base syntax is48 complete49 {50 <List of Substatements>51 }53where <List of Substatements> is a list of substatements.55The maximum number of loops defaults to 4096.56This value can be changed to any value between 1 and 1048576 for this loop.57To do so, put the desired value in parentheses after the "complete" keyword:59 complete(<Number>)60 {61 <List of Substatements>62 }64The input and output set can be specified between complete and the opening parenthesis,65i.e. you set the input set67 complete.<Name of Input Set>68 {69 <List of Substatements>70 }72or the output set74 complete->.<Name of Output Set>75 {76 <List of Substatements>77 }79or both81 complete.<Name of Input Set>->.<Name of Output Set>82 {83 <List of Substatements>84 }86resp.88 complete(<Number>).<Name of Input Set>->.<Name of Output Set>89 {90 <List of Substatements>91 }93*/95class Complete_Statement : public Output_Statement96{97public:98 Complete_Statement(int line_number_, const std::map< std::string, std::string >& attributes,99 Parsed_Query& global_settings);100 virtual void add_statement(Statement* statement, std::string text);102 virtual void execute(Resource_Manager& rman);105 static Generic_Statement_Maker< Complete_Statement > statement_maker;107 virtual std::string dump_xml(const std::string& indent) const1140 for (std::vector< Statement* >::const_iterator it = substatements.begin(); it != substatements.end(); ++it)120 virtual std::string dump_compact_ql(const std::string& indent) const12710669 q for (std::vector< Statement* >::const_iterator it = substatements.begin(); it != substatements.end(); ++it)134 virtual std::string dump_pretty_ql(const std::string& indent) const14110669 q for (std::vector< Statement* >::const_iterator it = substatements.begin(); it != substatements.end(); ++it)148private:149 std::string input;150 uint max_loop_num;151 std::vector< Statement* > substatements;152};155#endif