Blame view

morfeusz/Environment.hpp 2.39 KB
Michał Lenart authored
1
2
3
4
5
6
7
8
9
10
/* 
 * File:   Environment.hpp
 * Author: mlenart
 *
 * Created on 22 styczeń 2014, 12:08
 */

#ifndef ENVIRONMENT_HPP
#define	ENVIRONMENT_HPP
Michał Lenart authored
11
12
13
#include <vector>

class InterpretedChunksDecoder;
Michał Lenart authored
14
class CasePatternHelper;
Michał Lenart authored
15
Michał Lenart authored
16
17
#include "charset/CaseConverter.hpp"
#include "charset/CharsetConverter.hpp"
Michał Lenart authored
18
19
#include "fsa/fsa.hpp"
#include "segrules/segrules.hpp"
Michał Lenart authored
20
21
#include "const.hpp"
#include "Tagset.hpp"
Michał Lenart authored
22
23
//#include "InterpretedChunksDecoder.hpp"
#include "InterpsGroup.hpp"
Michał Lenart authored
24
#include "CasePatternHelper.hpp"
Michał Lenart authored
25
#include "Qualifiers.hpp"
Michał Lenart authored
26
#include "deserializer/InterpsGroupsReader.hpp"
Michał Lenart authored
27
Michał Lenart authored
28
struct InterpsGroup;
Michał Lenart authored
29
30
typedef FSA<InterpsGroupsReader> FSAType;
//typedef FSA< std::vector<InterpsGroup > > FSAType;
Michał Lenart authored
31
32
33
34

class Environment {
public:
    Environment(
Michał Lenart authored
35
36
            MorfeuszCharset charset,
            MorfeuszProcessorType morfeuszProcessor,
Michał Lenart authored
37
38
            const unsigned char* fileStartPtr);
Michał Lenart authored
39
    void setCharset(MorfeuszCharset charset);
Michał Lenart authored
40
Michał Lenart authored
41
42
    void setCaseSensitive(bool caseSensitive);
Michał Lenart authored
43
44
    const CharsetConverter& getCharsetConverter() const;
Michał Lenart authored
45
    const CaseConverter& getCaseConverter() const;
Michał Lenart authored
46
Michał Lenart authored
47
48
    void setTagset(const Tagset& tagset);
    const Tagset& getTagset() const;
Michał Lenart authored
49
Michał Lenart authored
50
51
    void setFSAFile(const std::string& filename);
Michał Lenart authored
52
53
    void setSegrulesOption(const std::string& option, const std::string& value);
Michał Lenart authored
54
55
56
57
58
    const SegrulesFSA& getCurrentSegrulesFSA() const;

    const FSAType& getFSA() const;

    const InterpretedChunksDecoder& getInterpretedChunksDecoder() const;
Michał Lenart authored
59
Michał Lenart authored
60
61
    MorfeuszProcessorType getProcessorType() const;
Michał Lenart authored
62
63
    const CasePatternHelper& getCasePatternHelper() const;
Michał Lenart authored
64
65
    const Qualifiers& getQualifiersHelper() const;
Michał Lenart authored
66
67
    bool isSeparator(uint32_t codepoint) const;
Michał Lenart authored
68
69
70
71
    virtual ~Environment();
private:
    const CharsetConverter* currentCharsetConverter;
    const CaseConverter caseConverter;
Michał Lenart authored
72
    Tagset tagset;
Michał Lenart authored
73
    Qualifiers qualifiers;
Michał Lenart authored
74
75
76

    const unsigned char* fsaFileStartPtr;
    const FSAType* fsa;
Michał Lenart authored
77
    std::vector<uint32_t> separatorsList;
Michał Lenart authored
78
    std::map<SegrulesOptions, SegrulesFSA*> segrulesFSAsMap;
Michał Lenart authored
79
    SegrulesOptions currSegrulesOptions;
Michał Lenart authored
80
81
82
83
    const SegrulesFSA* currSegrulesFSA;
    bool isFromFile;

    const InterpretedChunksDecoder* chunksDecoder;
Michał Lenart authored
84
    MorfeuszProcessorType processorType;
Michał Lenart authored
85
    CasePatternHelper* casePatternHelper;
Michał Lenart authored
86
87
88
89
90
91

    const CharsetConverter* getCharsetConverter(MorfeuszCharset charset) const;
};

#endif	/* ENVIRONMENT_HPP */