Overpass API regression suite coverage (Nova Scotia) / overpass_api/statements/print.h
overpass_api/statements/print.h
41 of 84 instrumented lines run by the suite (48.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 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__PRINT_H20#define DE__OSM3S___OVERPASS_API__STATEMENTS__PRINT_H22#include <map>23#include <string>24#include <vector>25#include "../data/collect_members.h"26#include "../data/utils.h"27#include "../frontend/output_handler.h"28#include "statement.h"31class Set_Comparison;33/* === Print (''out'') ===35The ''out'' statement can be configured with an arbitrary number of parameters that are appended, separated by whitespace, between the word ''out'' and the semicolon.37The ''out'' action takes an input set. It doesn't return a result set. The input set can be changed by prepending the variable name.39Allowed values, in any order, are:41* One of the following the degree of verbosity; default is ''body'':42** ''ids'': Print only the ids of the elements.43** ''skel'': Print also the minimum information necessary for geometry.44These are coordinates for nodes. For ways and relations, it are the members with role and ref.45** ''body'': Print all information necessary to use the data. These are also tags for all elements and the roles for relation members.46** ''tags'': Print only ids and tags for each element and not coordinates or members.47** ''meta'': Print everything known about the elements.48This includes additionally to ''body'' for all OSM elements the version, changeset id, timestamp, and the user data of the user that last touched the object.49Derived elements metadata attributes are also missing for derived elements.51The modificator ''noids'' lets all ids to be omitted from the statement.53* One of the following modificators for geolocated information, default is to print none:54** ''geom'': Add the full geometry to each object. This adds coordinates to each node, to each node member of a way or relation, and it adds a sequence of "nd" members with coordinates to all relations.55** ''bb'': Adds only the bounding box of each element to the element. For nodes this is equivalent to "geom".56For ways it is the enclosing bounding box of all nodes.57For relations it is the enclosing bounding box of all node and way members, relations as members have no effect.58** ''center'': This adds only the center of the above mentioned bounding box to ways and relations.59Note: The center point is not guaranteed to lie inside the polygon ([http://overpass-turbo.eu/s/4rr example]).60* A bounding box in the format "(south,west,north,east)" (normally used with the ''geom'' verbosity type). In this case, only elements whose coordinates are inside this bounding box are produced. For way segments, the first or last coordinates outside this bounding box are also produced to allow for properly formed segments (this restriction has no effect on derived elements without any geometry).62* One of the following for the sort order can be added. Default is ''asc'':63** ''asc'': Sort by object id.64** ''qt'': Sort by quadtile index; this is roughly geographical and significantly faster than order by ids (derived elements generated by ''make'' or ''convert'' statements without any geometry will be grouped separately, only sorted by id).66The modificator ''count'' lets the statement print only the [[#Counting of elements (out count)|total counts of elements]] in the input set and not the individual elements.67It cannot be combined with anything else.69A non-negative integer as modificator limits the output to a maximum of the given number.70Default is no limit.72*/75class Print_Statement : public Statement76{77 public:78 Print_Statement(int line_number_, const std::map< std::string, std::string >& attributes, Parsed_Query& global_settings);81 virtual void execute(Resource_Manager& rman);82 virtual ~Print_Statement();84 static Generic_Statement_Maker< Print_Statement > statement_maker;86 static std::string mode_string_xml(Output_Mode mode)880 if ((mode & (Output_Mode::VERSION | Output_Mode::META)) == (Output_Mode::VERSION | Output_Mode::META))900 else if ((mode & (Output_Mode::MEMBERS | Output_Mode::TAGS)) == (Output_Mode::MEMBERS | Output_Mode::TAGS))102 static std::string mode_string_ql(Output_Mode mode)1047166597 q if ((mode & (Output_Mode::VERSION | Output_Mode::META)) == (Output_Mode::VERSION | Output_Mode::META))1067118597 q else if ((mode & (Output_Mode::MEMBERS | Output_Mode::TAGS)) == (Output_Mode::MEMBERS | Output_Mode::TAGS))118 static std::string geometry_string_xml(Output_Mode mode)133 static std::string geometry_string_ql(Output_Mode mode)148 static std::string ids_string_xml(Output_Mode mode)153 static std::string ids_string_ql(Output_Mode mode)158 virtual std::string dump_xml(const std::string& indent) const1640 + (limit == std::numeric_limits< unsigned int >::max() ? "" : " limit=\"" + ::to_string(limit) + "\"")1743583597 q virtual std::string dump_compact_ql(const std::string& indent) const { return dump_subquery_map_ql(indent, false); }1753583597 q virtual std::string dump_pretty_ql(const std::string& indent) const { return dump_subquery_map_ql(indent, true); }177 std::string dump_subquery_map_ql(const std::string& indent, bool pretty) const1827166597 q + (limit == std::numeric_limits< unsigned int >::max() ? "" : " " + ::to_string(limit))189 private:190 std::string input;191 Output_Mode mode;192 enum { order_by_id, order_by_quadtile } order;193 unsigned int limit;194 Set_Comparison* collection_print_target;195 bool diff_valid;197 double south;198 double north;199 double west;200 double east;202 virtual void execute_comparison(Resource_Manager& rman);203};206#endif