blob: b85996f9747b195839e9ecdf9193881b1ae38470 (
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
|
#pragma once
#include "search/model.hpp"
#include "base/buffer_vector.hpp"
#include <cstdint>
namespace search
{
// There are 2 different ways of search index skipping:
// 1. Skip some feature's types.
// 2. Skip some feature's types when feature name is empty.
class TypesSkipper
{
public:
TypesSkipper();
void SkipTypes(feature::TypesHolder & types) const;
void SkipEmptyNameTypes(feature::TypesHolder & types) const;
bool IsCountryOrState(feature::TypesHolder const & types) const;
private:
using Cont = buffer_vector<uint32_t, 16>;
static bool HasType(Cont const & v, uint32_t t);
// Array index (0, 1) means type level for checking (1, 2).
// m_skipAlways is used in the case 1 described above.
Cont m_skipAlways[2];
// Exceptions for m_skipAlways.
// e.g. to support skipping all barriers except barrier = border_control.
Cont m_doNotSkip;
// m_skipIfEmptyName and m_dontSkipIfEmptyName are used in the case 2 described above.
Cont m_skipIfEmptyName[2];
TwoLevelPOIChecker m_dontSkipIfEmptyName;
uint32_t m_country, m_state;
};
} // namespace search
|