summaryrefslogtreecommitdiffstats
path: root/server/src/gpx.cppm
blob: 62674437d050d472ae006c7efa9712e026a05e9b (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
export module routemon:gpx;

import std;
import :geo.utm;
import :util;
import :xml;

namespace routemon::gpx {

struct metadata
{
  std::optional<std::string> name;
  std::optional<std::string> desc;
};

struct track_segment
{
  geo::utm::zonable_wgs84_linestring waypoints;
};

struct track
{
  std::optional<std::string> name;
  std::optional<std::string> desc;
  std::vector<track_segment> segments;
};

struct file
{
  std::string creator;
  metadata meta;
  std::vector<track> tracks;
};

class reader
{
  xml::executor e_;
  xml::parser<file> p_;

public:
  explicit reader();

  auto init() -> void;
  auto put(std::string_view buf) -> void;
  [[nodiscard]] auto finish() -> gpx::file;
};

} // namespace routemon::gpx