/src/aspell/modules/speller/default/wordinfo.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2000 by Kevin Atkinson under the terms of the LGPL |
2 | | |
3 | | #ifndef __aspeller_wordinfo__ |
4 | | #define __aspeller_wordinfo__ |
5 | | |
6 | | #include <assert.h> |
7 | | #include "string.hpp" |
8 | | |
9 | | namespace acommon { |
10 | | class OStream; |
11 | | class Convert; |
12 | | } |
13 | | |
14 | | namespace aspeller { |
15 | | |
16 | | // WordInfo |
17 | | |
18 | | typedef unsigned int WordInfo; // 4 bits |
19 | | |
20 | | enum CasePattern {Other, FirstUpper, AllLower, AllUpper}; |
21 | | // Other 00 |
22 | | // FirstUpper 01 |
23 | | // AllLower 10 |
24 | | // AllUpper 11 |
25 | | // First bit : is upper |
26 | | // Second bit: uniform case |
27 | | |
28 | | static const WordInfo CASE_PATTERN = 3; |
29 | | static const WordInfo ALL_PLAIN = (1 << 2); |
30 | | static const WordInfo ALL_CLEAN = (1 << 3); |
31 | | |
32 | | using namespace acommon; |
33 | | |
34 | | class Language; |
35 | | struct ConvertWord; |
36 | | |
37 | | // WordEntry is an entry in the dictionary. |
38 | | struct WordEntry |
39 | | { |
40 | | const char * word; |
41 | | const char * aff; |
42 | | const char * catg; |
43 | | void (* adv_)(WordEntry *); |
44 | | void * intr[3]; |
45 | | unsigned word_size; |
46 | | enum What {Other, Word, Soundslike, Clean, Misspelled} what; |
47 | | WordInfo word_info; |
48 | | int frequency; // 0 .. 255 |
49 | | // if type is Word than aff will be defined, otherwise it won't |
50 | 50.7M | bool at_end() {return !word;} |
51 | 15.4M | bool adv() {if (adv_) {adv_(this); return true;} word = 0; return false;} |
52 | 0 | operator bool () const {return word != 0;} |
53 | | OStream & write(OStream & o, const Language & l, Convert * c = 0) const; |
54 | 47.9M | WordEntry() {memset(this, 0, sizeof(WordEntry));} |
55 | 40.0M | void clear() {memset(this, 0, sizeof(WordEntry));} |
56 | 48.1M | ~WordEntry() {} |
57 | | }; |
58 | | } |
59 | | |
60 | | #endif |