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

types_mapping.cpp « indexer - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8f04c8c9750d2bba7696055df6d992c478c92c0 (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
#include "types_mapping.hpp"
#include "classificator.hpp"

#include "../base/string_utils.hpp"
#include "../base/stl_add.hpp"


void BaseTypeMapper::Load(string const & buffer)
{
  istringstream ss(buffer);
  Classificator & c = classif();

  string v;
  vector<string> path;

  uint32_t ind = 0;
  while (true)
  {
    ss >> v;

    if (ss.eof())
      break;

    path.clear();
    strings::Tokenize(v, "|", MakeBackInsertFunctor(path));

    Add(ind++, c.GetTypeByPath(path));
  }
}

void Index2Type::Add(uint32_t ind, uint32_t type)
{
  ASSERT_EQUAL ( ind, m_types.size(), () );
  m_types.push_back(type);
}

void Type2Index::Add(uint32_t ind, uint32_t type)
{
  VERIFY ( m_map.insert(make_pair(type, ind)).second, (type, ind) );
}