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

types_helper.hpp « generator_tests « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b8173e81b505c9de6123901286c33efa94eedb13 (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
38
39
40
41
42
43
44
#pragma once

#include "generator/osm_element.hpp"

#include "indexer/classificator.hpp"
#include "indexer/feature_data.hpp"

#include "base/stl_add.hpp"

#include <string>
#include <vector>


namespace tests
{

template <size_t N, size_t M>
inline void AddTypes(FeatureParams & params, char const * (&arr)[N][M])
{
  Classificator const & c = classif();

  for (size_t i = 0; i < N; ++i)
    params.AddType(c.GetTypeByPath(std::vector<std::string>(arr[i], arr[i] + M)));
}

inline void FillXmlElement(char const * arr[][2], size_t count, OsmElement * p)
{
  for (size_t i = 0; i < count; ++i)
    p->AddTag(arr[i][0], arr[i][1]);
}

template <size_t N>
inline uint32_t GetType(char const * (&arr)[N])
{
  std::vector<std::string> path(arr, arr + N);
  return classif().GetTypeByPath(path);
}

inline uint32_t GetType(my::StringIL const & lst)
{
  return classif().GetTypeByPath(lst);
}

} // namespace tests