forked from ZDisket/TensorVox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phoneticdict.cpp
63 lines (39 loc) · 860 Bytes
/
phoneticdict.cpp
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "phoneticdict.h"
#include "ext/ZFile.h"
ZFILE_IOVR(DictEntry,inentr){
right << inentr.Word;
right << inentr.PhSpelling;
return right;
}
ZFILE_OOVR(DictEntry,entr){
right >> entr.Word;
right >> entr.PhSpelling;
return right;
}
PhoneticDict::PhoneticDict()
{
}
void PhoneticDict::Export(const QString &exfn)
{
ZFile ofi;
ofi.Open(exfn.toStdString(),EZFOpenMode::BinaryWrite);
ofi << Entries;
ofi.Close();
}
bool PhoneticDict::Import(const QString &infn)
{
ZFile fi;
if (!fi.Open(infn.toStdString(),EZFOpenMode::BinaryRead))
return false;
if (fi.GetFileLength() == 0){
fi.Close();
return true;
}
fi >> Entries;
fi.Close();
return true;
}
bool operator==(const DictEntry &left, const std::string &right)
{
return left.Word == right;
}