1 #include "dictionaries.h"
2 #include "preferences.h"
4 Dictionaries::Dictionaries() {
10 /* Load file names from preferences object - TO DO */
11 /* For now, just do a hard-coded load */
14 LoadKDict("kanjidic");
15 LoadKRadFile("kradfile");
16 LoadRadKFile("radkfile");
19 Dictionaries::~Dictionaries() {
20 if(wdict
) delete wdict
;
21 /* kdict should NOT be destroyed here; KDict::Destroy() should be called
22 instead. I did this in jben.cpp's OnExit event. */
23 if(kradfile
) delete kradfile
;
24 if(radkfile
) delete radkfile
;
27 bool Dictionaries::LoadWDict(const char* filename
) {
29 wdict
= WDict::LoadWDict(filename
, result
);
30 if(result
== ED_SUCCESS
) return true;
34 bool Dictionaries::LoadKDict(const char* filename
) {
35 /* I have a feeling this class will be tossed soon, as
36 the 4 classes it loads will be consolidated down to 2
37 singletons, making this loader class obsolete. */
38 /* Because of the above, I'm ignoring the filename arg
42 if(kdict
!=NULL
&& kdict
->GetHashTable()!=NULL
) return true;
46 bool Dictionaries::LoadKRadFile(const char* filename
) {
47 int result
= 0xDEADBEEF;
48 kradfile
= KRadFile::LoadKRad(filename
, result
);
49 if(result
== KRAD_SUCCESS
) return true;
53 bool Dictionaries::LoadRadKFile(const char* filename
) {
54 int result
= 0xDEADBEEF;
55 radkfile
= RadKFile::LoadRadK(filename
, result
);
56 if(result
== RADK_SUCCESS
) return true;
60 const WDict
* Dictionaries::GetWDict() {return wdict
;}
61 const KDict
* Dictionaries::GetKDict() {return kdict
;}
62 const KRadFile
* Dictionaries::GetKRadFile() {return kradfile
;}
63 const RadKFile
* Dictionaries::GetRadKFile() {return radkfile
;}