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

locality.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0bc5e5fa81e335928ebb0fb2bde948a8d0a88b55 (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
45
46
47
48
49
50
51
#pragma once
#include "indexer/ftypes_matcher.hpp"

#include "geometry/point2d.hpp"

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

#include "std/string.hpp"
#include "std/vector.hpp"

namespace search
{
struct Locality
{
  using TToken = strings::UniString;
  using TTokensArray = buffer_vector<TToken, 32>;

  // Native and English names of locality.
  string m_name;
  string m_enName;

  // Indexes of matched tokens for locality.
  vector<size_t> m_matchedTokens;

  ftypes::Type m_type;
  uint32_t m_featureId;
  m2::PointD m_center;
  uint8_t m_rank;
  double m_radius;

  Locality();

  Locality(ftypes::Type type, uint32_t featureId, m2::PointD const & center, uint8_t rank);

  bool IsValid() const;

  bool IsSuitable(TTokensArray const & tokens, TToken const & prefix) const;

  void Swap(Locality & rhs);

  bool operator<(Locality const & rhs) const;

private:
  bool IsFullNameMatched() const;

  size_t GetSynonymTokenLength(TTokensArray const & tokens, TToken const & prefix) const;
};

string DebugPrint(Locality const & l);
}  // namespace search