]> git.lyx.org Git - lyx.git/blob - src/Thesaurus.C
include shuffling and a mathed compile fix
[lyx.git] / src / Thesaurus.C
1 /**
2  * \file Thesaurus.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #include "Thesaurus.h"
10
11 Thesaurus thesaurus; 
12
13 #ifdef HAVE_LIBAIKSAURUS
14  
15 Thesaurus::ThesaurusEntry::ThesaurusEntry(string const & ent, char part)
16         : entry(ent), pos(Thesaurus::NONE)
17 {
18         if (part & AikSaurus::Unknown)
19                 pos |= OTHER;
20         if (part & AikSaurus::Other)
21                 pos |= OTHER;
22         if (part & AikSaurus::Noun)
23                 pos |= NOUN;
24         if (part & AikSaurus::Verb)
25                 pos |= VERB;
26         if (part & AikSaurus::Adjective)
27                 pos |= ADJECTIVE;
28         if (part & AikSaurus::Adverb)
29                 pos |= ADVERB;
30 }
31
32
33 Thesaurus::Thesaurus()
34 {
35         aik_ = new AikSaurus;
36 }
37
38
39 Thesaurus::~Thesaurus()
40 {
41         delete aik_;
42 }
43
44
45 std::vector<Thesaurus::ThesaurusEntry> Thesaurus::lookup(string const & text)
46 {
47         std::vector<ThesaurusEntry> entries;
48
49         if (!aik_->find(text.c_str()))
50                 return entries;
51
52         char pos;
53
54         string ret = aik_->next(pos);
55         while (!ret.empty()) {
56                 entries.push_back(ThesaurusEntry(ret, pos));
57                 ret = aik_->next(pos);
58         }
59
60         return entries;
61 }
62
63 #else
64
65 Thesaurus::ThesaurusEntry::ThesaurusEntry(string const &, char)
66 {
67 }
68
69  
70 Thesaurus::Thesaurus()
71 {
72 }
73  
74  
75 Thesaurus::~Thesaurus()
76 {
77 }
78
79  
80 std::vector<Thesaurus::ThesaurusEntry>
81 Thesaurus::lookup(string const & /*text*/)
82 {
83         return std::vector<ThesaurusEntry>();
84 }
85
86 #endif // HAVE_LIBAIKSAURUS