1 |
/* -*- C++ -*- |
2 |
|
3 |
MacOS X implementation of the SKK input method. |
4 |
|
5 |
Copyright (C) 2008 Tomotaka SUWA <t.suwa@mac.com> |
6 |
|
7 |
This program is free software; you can redistribute it and/or modify |
8 |
it under the terms of the GNU General Public License as published by |
9 |
the Free Software Foundation; either version 2 of the License, or |
10 |
any later version. |
11 |
|
12 |
This program is distributed in the hope that it will be useful, |
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
GNU General Public License for more details. |
16 |
|
17 |
You should have received a copy of the GNU General Public License |
18 |
along with this program; if not, write to the Free Software |
19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
|
21 |
*/ |
22 |
|
23 |
#ifndef SKKDictionaryKeeper_h |
24 |
#define SKKDictionaryKeeper_h |
25 |
|
26 |
#include "SKKDictionaryFile.h" |
27 |
#include "SKKDictionaryLoader.h" |
28 |
#include "pthreadutil.h" |
29 |
#include <vector> |
30 |
#include <memory> |
31 |
|
32 |
class SKKDictionaryKeeper : public SKKDictionaryLoaderObserver { |
33 |
std::auto_ptr<pthread::timer> timer_; |
34 |
pthread::condition condition_; |
35 |
SKKDictionaryFile file_; |
36 |
bool loaded_; |
37 |
int timeout_; |
38 |
|
39 |
virtual void SKKDictionaryLoaderUpdate(const SKKDictionaryFile& file); |
40 |
|
41 |
std::string fetch(const std::string& query, SKKDictionaryEntryContainer& container); |
42 |
bool ready(); |
43 |
|
44 |
public: |
45 |
SKKDictionaryKeeper(); |
46 |
|
47 |
void Initialize(SKKDictionaryLoader* loader, int interval, int timeout); |
48 |
|
49 |
// ��������������� |
50 |
std::string FindOkuriAri(const std::string& query); |
51 |
std::string FindOkuriNasi(const std::string& query); |
52 |
|
53 |
// ��������� |
54 |
std::string FindEntry(const std::string& candidate); |
55 |
|
56 |
// ������������������ |
57 |
bool FindCompletions(const std::string& entry, |
58 |
std::vector<std::string>& result, |
59 |
unsigned minimumCompletionLength = 0); |
60 |
}; |
61 |
|
62 |
#endif |