Welcome to mirror list, hosted at ThFree Co, Russian Federation.

collector_tag.hpp « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 25c43bdd55e0bfedccb4c0d2ab4fe97fcec393c7 (plain)
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
#pragma once

#include "generator/collector_interface.hpp"

#include <fstream>
#include <functional>
#include <string>

struct OsmElement;
namespace base
{
class GeoObjectId;
}  // namespace base

namespace generator
{
// CollectorTag class collects validated value of a tag and saves it to file with following
// format: osmId<tab>tagValue.
class CollectorTag : public CollectorInterface
{
public:
  using Validator = std::function<bool(std::string const & tagValue)>;

  explicit CollectorTag(std::string const & filename, std::string const & tagKey,
                        Validator const & validator, bool ignoreIfNotOpen = false);

  // CollectorInterface overrides:
  void Collect(OsmElement const & el) override;
  void Save() override {}

private:
  std::ofstream m_stream;
  std::string m_tagKey;
  Validator m_validator;
  bool m_needCollect;
};
}  // namespace generator