-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKasumiWord.hxx
102 lines (83 loc) · 3.15 KB
/
KasumiWord.hxx
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*********************************************************************
*
* KasumiWord.hxx
*
* Kasumi - a management tool for a private dictionary of anthy
*
* Copyright (C) 2004-2006 Takashi Nakamoto
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*********************************************************************/
#ifndef __KASUMI_WORD_HXX__
#define __KASUMI_WORD_HXX__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#include <map>
#include "KasumiException.hxx"
#include "KasumiConfiguration.hxx"
#include "KasumiWordType.hxx"
#include "KasumiWordEventListener.hxx"
#include <iconv.h>
#include <vector>
using namespace std;
class KasumiWord{
private:
bool IsEUCJP;
string Sound; // corresponding "Yomi" in private-dic.src
string Sound_UTF8;
int Frequency; // corresponding "Hindo"
string Spelling; // corresponding "Tango"
string Spelling_UTF8;
unsigned int id;
vector<KasumiWordEventListener*> EventListeners;
KasumiWordType *mWordType;
static iconv_t IconvUTF8_To_EUCJP;
static iconv_t IconvEUCJP_To_UTF8;
// confirms if the given sound consists of only Hiragana
// if no invalid character, returns empty string
static string extractInvalidCharacterFromSound(string soundByUTF8);
static unsigned int id_generator;
static vector<KasumiWord*> words;
KasumiWord(KasumiConfiguration *conf);
public:
static KasumiWord* createNewWord(KasumiConfiguration *conf);
// property functions
void setSound(const string &aSound)
throw(KasumiException);
void setSoundByUTF8(const string &aSound)
throw(KasumiException);
string getSound(){ return Sound; };
string getSoundByUTF8(){ return Sound_UTF8; };
void setFrequency(int aFrequency);
int getFrequency(){ return Frequency; };
void setSpelling(const string &aSpelling);
void setSpellingByUTF8(const string &aSpelling);
string getSpelling(){ return Spelling; };
string getSpellingByUTF8(){ return Spelling_UTF8; };
void setWordType(KasumiWordType *aType);
KasumiWordType *getWordType() { return mWordType; };
string getWordTypeUIString(); // UTF8
unsigned int getID(){ return id; };
void registerEventListener(KasumiWordEventListener *listener);
void removeEventListener(KasumiWordEventListener *listener);
static KasumiWord *getWordFromID(unsigned int id);
static string convertUTF8ToEUCJP(const string &aEUCJP);
static string convertEUCJPToUTF8(const string &aUTF8);
};
#endif