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

slof_dictionary.hpp « words - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9c9fc000878c01a5315cee4f4669d25b7bfc7d08 (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
#pragma once
#include "dictionary.hpp"
#include "slof.hpp"
#include "../std/function.hpp"
#include "../std/scoped_ptr.hpp"

class Reader;

namespace sl
{

class SlofDictionary : public Dictionary
{
public:
  // Takes ownership of pReader and deletes it, even if exception is thrown.
  explicit SlofDictionary(Reader const * pReader);
  // Takes ownership of pReader and deletes it, even if exception is thrown.
  SlofDictionary(Reader const * pReader,
                 function<void (char const *, size_t, char *, size_t)> decompressor);
  ~SlofDictionary();
  Id KeyCount() const;
  void KeyById(Id id, string & key) const;
  void ArticleById(Id id, string & article) const;
private:
  void Init();
  void ReadKeyData(Id id, string & data) const;
  scoped_ptr<Reader const> m_pReader;
  function<void (char const *, size_t, char *, size_t)> m_Decompressor;
  SlofHeader m_Header;
};

}