|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
/*
* 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>
|
|
16
|
#include <list>
|
|
17
18
19
20
21
|
namespace morfeusz {
class DictionariesRepository {
public:
|
|
22
23
24
|
DictionariesRepository();
|
|
25
26
|
const Dictionary* getDictionary(const std::string& name, MorfeuszProcessorType processorType);
|
|
27
|
const Dictionary* getDefaultDictionary(MorfeuszProcessorType processorType);
|
|
28
|
|
|
29
30
|
static std::string getDictionaryFilename(const std::string& name, MorfeuszProcessorType processorType);
|
|
31
|
static DictionariesRepository& getInstance();
|
|
32
33
|
private:
|
|
34
35
|
struct RepositoryEntry {
|
|
36
|
RepositoryEntry(): analyzerDictionary(NULL), generatorDictionary(NULL) {}
|
|
37
38
|
Dictionary* analyzerDictionary;
Dictionary* generatorDictionary;
|
|
39
|
Dictionary* getDictionary(MorfeuszProcessorType processorType) const;
|
|
40
41
|
};
|
|
42
43
44
45
46
47
48
49
50
|
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();
|
|
51
52
53
54
55
56
|
std::map<std::string, RepositoryEntry> entriesMap;
};
}
#endif /* DICTIONARIESREPOSITORY_HPP */
|