compressionByteUtils.hpp
1.43 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
/*
* File: compressionByteUtils.hpp
* Author: lennyn
*
* Created on April 23, 2014, 4:38 PM
*/
#ifndef COMPRESSIONBYTEUTILS_HPP
#define COMPRESSIONBYTEUTILS_HPP
#include "InterpsGroup.hpp"
namespace morfeusz {
class CompressionByteFlags {
public:
static const unsigned char ORTH_ONLY_LOWER = 128;
static const unsigned char ORTH_ONLY_TITLE = 64;
static const unsigned char LEMMA_ONLY_LOWER = 32;
static const unsigned char LEMMA_ONLY_TITLE = 16;
static const unsigned char PREFIX_CUT_MASK = 15;
};
inline bool hasCompressedOrthCasePatterns(unsigned char byte) {
return byte & (CompressionByteFlags::ORTH_ONLY_LOWER | CompressionByteFlags::ORTH_ONLY_TITLE);
}
inline bool isOrthOnlyLower(unsigned char byte) {
return byte & CompressionByteFlags::ORTH_ONLY_LOWER;
}
inline bool isOrthOnlyTitle(unsigned char byte) {
return byte & CompressionByteFlags::ORTH_ONLY_TITLE;
}
inline bool isLemmaOnlyLower(unsigned char byte) {
return byte & CompressionByteFlags::LEMMA_ONLY_LOWER;
}
inline bool isLemmaOnlyTitle(unsigned char byte) {
return byte & CompressionByteFlags::LEMMA_ONLY_TITLE;
}
inline bool hasCompressedPrefixCut(unsigned char byte) {
return (byte & CompressionByteFlags::PREFIX_CUT_MASK) != CompressionByteFlags::PREFIX_CUT_MASK;
}
inline unsigned char getPrefixCutLength(unsigned char byte) {
return byte & CompressionByteFlags::PREFIX_CUT_MASK;
}
}
#endif /* COMPRESSIONBYTEUTILS_HPP */