Overpass API regression suite coverage (Saxony) / overpass_api/statements/timeline.h

overpass_api/statements/timeline.h

20 of 27 instrumented lines run by the suite (74.1%) 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#ifndef DE__OSM3S___OVERPASS_API__STATEMENTS__TIMELINE_H
20#define DE__OSM3S___OVERPASS_API__STATEMENTS__TIMELINE_H
22#include <map>
23#include <string>
24#include <vector>
26#include "evaluator.h"
27#include "statement.h"
30/* === The statement <em>timeline</em> ===
32''since v0.7.55''
34The statement <em>timeline</em> takes type and id of an object and optionally version as arguments.
35It then returns a derived structure containing the meta information of the specified version.
36If no version is specified then one object for each known version is returned.
37Each of these objects has tags <em>ref</em>, <em>reftype</em>, and <em>refversion</em> to identify the reference.
38In addition, it has tags <em>created</em> and <em>expired</em> that contain the relevant timestamps.
40The base syntax is
42 timeline(<Type>, <Ref>);
44resp.
46 timeline(<Type>, <Ref>, <Version>);
48where <Type> is one of the three literals node, way, or relation.
50In addition, an output set <Set> can be specified:
52 timeline(<Type>, <Ref>)->.<Set>;
54resp.
56 timeline(<Type>, <Ref>, <Version>)->.<Set>;
58*/
60class Timeline_Statement : public Output_Statement
62public:
63 Timeline_Statement(int line_number_, const std::map< std::string, std::string >& attributes,
64 Parsed_Query& global_settings);
6514837 q virtual std::string get_name() const { return "timeline"; }
66 virtual void execute(Resource_Manager& rman);
68 static Generic_Statement_Maker< Timeline_Statement > statement_maker;
70 static std::string to_string(int type)
717437 q {
727437 q if (type == Statement::NODE)
732814 q return "node";
744623 q else if (type == Statement::WAY)
752412 q return "way";
772211 q return "relation";
787437 q }
80 virtual std::string dump_xml(const std::string& indent) const
810 {
820 std::string result = indent + "<timeline" + std::string(" type=\"") + to_string(type) + "\""
830 " ref=\"" + ::to_string(ref) + "\"";
840 if (version)
850 result += " version=\"" + ::to_string(version) + "\"";
870 return result + dump_xml_result_name() + "/>\n";
880 }
90 virtual std::string dump_compact_ql(const std::string& indent) const
913737 q {
923737 q std::string result = "timeline(" + to_string(type) + "," + ::to_string(ref);
933737 q if (version)
9466 q result += "," + ::to_string(version);
963737 q return result + ")" + dump_ql_result_name() + ";";
973737 q }
99 virtual std::string dump_pretty_ql(const std::string& indent) const
1013737 q std::string result = indent + "timeline(" + to_string(type) + ", " + ::to_string(ref);
1023737 q if (version)
10366 q result += ", " + ::to_string(version);
1053737 q return result + ")" + dump_ql_result_name() + ";";
108private:
109 int type;
110 uint64 ref;
111 uint32 version;
112};
115#endif