Newer
Older
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
#include "PyZyPhoneticContext.h"
#include "PyZyFullPinyinContext.h"
#include "PyZyDoublePinyinContext.h"
#include "PyZyBopomofoContext.h"
#include "PyZyDatabase.h"
namespace PyZy {
void
InputContext::init ()
{
init ("libpyzy");
}
void
InputContext::init (const std::string & user_data_dir)
{
Database::init (user_data_dir);
}
void
InputContext::finalize ()
{
Database::finalize ();
}
InputContext *
InputContext::create (InputContext::InputType type,
Config & config,
InputContext::Observer * observer) {
switch (type) {
case FULL_PINYIN:
return new FullPinyinContext (config, observer);
case DOUBLE_PINYIN:
return new DoublePinyinContext (config, observer);
case BOPOMOFO:
return new BopomofoContext (config, observer);
default:
g_warning ("unknown context type.\n");
return NULL;
}
}
} // namespace PyZy