libosmscout  1.1.1
GenTextIndex.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_IMPORT_GENTEXTINDEX_H
2 #define OSMSCOUT_IMPORT_GENTEXTINDEX_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2013 Preet Desai
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  */
22 
23 #include <marisa.h>
24 
25 #include <osmscout/OSMScoutTypes.h>
26 #include <osmscout/ObjectRef.h>
27 
28 #include <osmscout/import/Import.h>
29 
31 
32 namespace osmscout
33 {
34  class TextIndexGenerator CLASS_FINAL : public ImportModule
35  {
36  public:
37  void GetDescription(const ImportParameter& parameter,
38  ImportModuleDescription& description) const override;
39 
40  bool Import(const TypeConfigRef& typeConfig,
41  const ImportParameter &parameter,
42  Progress &progress) override;
43 
44  private:
45  uint8_t GetFileOffsetSizeBytes(const ImportParameter &parameter,
46  Progress &progress);
47 
48  bool AddNodeTextToKeysets(const ImportParameter &parameter,
49  Progress &progress,
50  const TypeConfig &typeConfig,
51  uint8_t offsetSizeBytes);
52 
53  bool AddWayTextToKeysets(const ImportParameter &parameter,
54  Progress &progress,
55  const TypeConfig &typeConfig,
56  uint8_t offsetSizeBytes);
57 
58  bool AddAreaTextToKeysets(const ImportParameter &parameter,
59  Progress &progress,
60  const TypeConfig &typeConfig,
61  uint8_t offsetSizeBytes);
62 
63  bool BuildKeyStr(const std::string& text,
64  uint8_t offsetSizeBytes,
65  FileOffset offset,
66  const RefType& reftype,
67  std::string& keyString) const;
68 
69  // keysets used to store text data and generate tries
70  marisa::Keyset keysetPoi;
71  marisa::Keyset keysetLocation;
72  marisa::Keyset keysetRegion;
73  marisa::Keyset keysetOther;
74  };
75 }
76 
77 
78 #endif // OSMSCOUT_IMPORT_GENTEXTINDEX_H
RefType
Definition: ObjectRef.h:131
Definition: Area.h:38
#define CLASS_FINAL
Definition: Compiler.h:26
uint64_t FileOffset
Definition: OSMScoutTypes.h:47
std::shared_ptr< TypeConfig > TypeConfigRef
Definition: TypeConfig.h:1227