Overpass API regression suite coverage (Nova Scotia) / overpass_api/output_formats/output_popup.h
overpass_api/output_formats/output_popup.h
18 of 18 instrumented lines run by the suite (100.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__OUTPUT_FORMATS__OUTPUT_POPUP_H20#define DE__OSM3S___OVERPASS_API__OUTPUT_FORMATS__OUTPUT_POPUP_H23#include "../core/datatypes.h"24#include "../core/geometry.h"25#include "../data/regular_expression.h"26#include "../frontend/output_handler.h"28#include <string>29#include <vector>32class Tag_Filter33{34public:35 Tag_Filter(const std::string& key_, const std::string& value_, bool straight_)38 bool matches(const std::vector< std::pair< std::string, std::string > >* tags) const;40private:41 std::string key;42 bool straight;43 Regular_Expression condition;44};47struct Category_Filter48{51 ~Category_Filter()538818 q for (std::vector< std::vector< Tag_Filter* > >::iterator it_conj = filter_disjunction.begin();5613211 q for (std::vector< Tag_Filter* >::iterator it = it_conj->begin(); it != it_conj->end(); ++it)61 void set_title(const std::string& title);62 void set_title_key(const std::string& title_key);636011 q void add_filter(const std::vector< Tag_Filter* >& conjunction) { filter_disjunction.push_back(conjunction); }65 bool consider(const Node_Skeleton& skel, const std::vector< std::pair< std::string, std::string > >* tags);66 bool consider(const Way_Skeleton& skel, const std::vector< std::pair< std::string, std::string > >* tags);67 bool consider(const Relation_Skeleton& skel, const std::vector< std::pair< std::string, std::string > >* tags);71private:72 Category_Filter(const Category_Filter&);73 const Category_Filter& operator=(const Category_Filter&);75 std::string output;76 std::string title_key;77 std::vector< std::vector< Tag_Filter* > > filter_disjunction;78};81class Output_Popup : public Output_Handler82{83public:86 virtual ~Output_Popup()8816018 q for (std::vector< Category_Filter* >::iterator it = categories.begin(); it != categories.end(); ++it)92 virtual bool write_http_headers();93 virtual void write_payload_header(const std::string& db_dir,94 const std::string& timestamp, const std::string& area_timestamp);95 virtual void write_footer();96 virtual void display_remark(const std::string& text);97 virtual void display_error(const std::string& text);101 virtual void print_item(const Node_Skeleton& skel,102 const Opaque_Geometry& geometry,103 const std::vector< std::pair< std::string, std::string > >* tags,104 const OSM_Element_Metadata_Skeleton< Node::Id_Type >* meta,105 const std::map< uint32, std::string >* users,106 Output_Mode mode,107 const Feature_Action& action = keep,108 const Node_Skeleton* new_skel = 0,109 const Opaque_Geometry* new_geometry = 0,110 const std::vector< std::pair< std::string, std::string > >* new_tags = 0,111 const OSM_Element_Metadata_Skeleton< Node::Id_Type >* new_meta = 0);113 virtual void print_item(const Way_Skeleton& skel,114 const Opaque_Geometry& geometry,115 const std::vector< std::pair< std::string, std::string > >* tags,116 const OSM_Element_Metadata_Skeleton< Way::Id_Type >* meta,117 const std::map< uint32, std::string >* users,118 Output_Mode mode,119 const Feature_Action& action = keep,120 const Way_Skeleton* new_skel = 0,121 const Opaque_Geometry* new_geometry = 0,122 const std::vector< std::pair< std::string, std::string > >* new_tags = 0,123 const OSM_Element_Metadata_Skeleton< Way::Id_Type >* new_meta = 0);125 virtual void print_item(const Relation_Skeleton& skel,126 const Opaque_Geometry& geometry,127 const std::vector< std::pair< std::string, std::string > >* tags,128 const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* meta,129 const std::map< uint32, std::string >* roles,130 const std::map< uint32, std::string >* users,131 Output_Mode mode,132 const Feature_Action& action = keep,133 const Relation_Skeleton* new_skel = 0,134 const Opaque_Geometry* new_geometry = 0,135 const std::vector< std::pair< std::string, std::string > >* new_tags = 0,136 const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* new_meta = 0);138 virtual void print_item(const Derived_Skeleton& skel,139 const Opaque_Geometry& geometry,140 const std::vector< std::pair< std::string, std::string > >* tags,141 Output_Mode mode,142 const Feature_Action& action = keep);144private:145 std::vector< Category_Filter* > categories;146};149#endif