Overpass API regression suite coverage (Saxony) / overpass_api/statements/union.cc

overpass_api/statements/union.cc

30 of 32 instrumented lines run by the suite (93.8%) 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#include <algorithm>
20#include <list>
21#include <map>
22#include <set>
23#include <sstream>
24#include <string>
25#include <vector>
27#include "../data/abstract_processing.h"
28#include "../data/utils.h"
29#include "union.h"
32Generic_Statement_Maker< Union_Statement > Union_Statement::statement_maker("union");
35Union_Statement::Union_Statement
36 (int line_number_, const std::map< std::string, std::string >& input_attributes, Parsed_Query& global_settings)
3732197 q : Output_Statement(line_number_)
3832197 q{
3932197 q std::map< std::string, std::string > attributes;
4132197 q attributes["into"] = "_";
4332197 q eval_attributes_array(get_name(), attributes, input_attributes);
4532197 q set_output(attributes["into"]);
4632197 q}
49void Union_Statement::add_statement(Statement* statement, std::string text)
5040275 q{
5140275 q assure_no_text(text, this->get_name());
5440275 q if (statement)
5540275 q {
5640275 q if (statement->get_name() == "newer")
570 add_static_error("\"newer\" can appear only inside \"query\" statements.");
5840275 q else if (statement->get_result_name() == "")
590 substatement_error(get_name(), statement);
6040275 q else
6140275 q substatements.push_back(statement);
6240275 q }
6340275 q}
66void Union_Statement::execute(Resource_Manager& rman)
672747796 q{
682747796 q rman.push_stack_frame();
692747796 q rman.move_outward(get_result_name(), get_result_name());
712747796 q for (std::vector< Statement* >::iterator it(substatements.begin());
725321496 q it != substatements.end(); ++it)
732573774 q {
742573774 q (*it)->execute(rman);
752573774 q rman.union_inward((*it)->get_result_name(), get_result_name());
762573774 q }
782747796 q rman.move_all_inward_except(get_result_name());
792747796 q rman.pop_stack_frame();
812747796 q rman.health_check(*this);
822747796 q}