]> git.lyx.org Git - lyx.git/blob - src/Thesaurus.C
whitespace changes;
[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) pos |= OTHER;
19         if (part & AikSaurus::Other) pos |= OTHER;
20         if (part & AikSaurus::Noun) pos |= NOUN;
21         if (part & AikSaurus::Verb) pos |= VERB;
22         if (part & AikSaurus::Adjective) pos |= ADJECTIVE;
23         if (part & AikSaurus::Adverb) pos |= ADVERB;
24 }
25
26
27 Thesaurus::Thesaurus()
28 {
29         aik_ = new AikSaurus();
30 }
31
32
33 Thesaurus::~Thesaurus()
34 {
35         delete aik_;
36 }
37
38
39 std::vector<Thesaurus::ThesaurusEntry> Thesaurus::lookup(string const & text)
40 {
41         std::vector<ThesaurusEntry> entries;
42
43         if (!aik_->find(text.c_str()))
44                 return entries;
45
46         char pos;
47         string ret;
48
49         ret = aik_->next(pos);
50         while (!ret.empty()) {
51                 entries.push_back(ThesaurusEntry(ret, pos));
52                 ret = aik_->next(pos);
53         }
54
55         return entries;
56 }
57
58 #else
59
60 Thesaurus::ThesaurusEntry::ThesaurusEntry(string const &, char)
61 {
62 }
63
64  
65 Thesaurus::Thesaurus()
66 {
67 }
68  
69  
70 Thesaurus::~Thesaurus()
71 {
72 }
73
74  
75 std::vector<Thesaurus::ThesaurusEntry>
76 Thesaurus::lookup(string const & /*text*/)
77 {
78         return std::vector<ThesaurusEntry>();
79 }
80
81 #endif // HAVE_LIBAIKSAURUS