DictionariesRepository.hpp
1.67 KB
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
52
53
54
55
56
/*
* File: DictionariesRepository.hpp
* Author: lennyn
*
* Created on August 8, 2014, 3:49 PM
*/
#ifndef DICTIONARIESREPOSITORY_HPP
#define DICTIONARIESREPOSITORY_HPP
#include "morfeusz2.h"
#include "Dictionary.hpp"
#include "const.hpp"
#include <map>
#include <string>
#include <list>
namespace morfeusz {
class DictionariesRepository {
public:
DictionariesRepository();
const Dictionary* getDictionary(const std::string& name, MorfeuszProcessorType processorType);
const Dictionary* getDefaultDictionary(MorfeuszProcessorType processorType);
static std::string getDictionaryFilename(const std::string& name, MorfeuszProcessorType processorType);
static DictionariesRepository& getInstance();
private:
struct RepositoryEntry {
RepositoryEntry(): analyzerDictionary(NULL), generatorDictionary(NULL) {}
Dictionary* analyzerDictionary;
Dictionary* generatorDictionary;
Dictionary* getDictionary(MorfeuszProcessorType processorType) const;
};
bool hasLoadedDictionary(const std::string& name, MorfeuszProcessorType processorType) const;
bool tryToLoadDictionary(const std::string& name, MorfeuszProcessorType processorType);
void doLoadDictionary(const std::string& dictName, const std::string& filepath, MorfeuszProcessorType processorType);
static std::map<std::string, DictionariesRepository::RepositoryEntry> getDefaultEntriesMap();
std::map<std::string, RepositoryEntry> entriesMap;
};
}
#endif /* DICTIONARIESREPOSITORY_HPP */