| 1 | /********************************************************************* |
| 2 | * |
| 3 | * KasumiDic.hxx |
| 4 | * |
| 5 | * Kasumi - a management tool for a private dictionary of anthy |
| 6 | * |
| 7 | * Copyright (C) 2004-2006 Takashi Nakamoto |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License |
| 11 | * as published by the Free Software Foundation; either version 2 |
| 12 | * of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 22 | * MA 02110-1301, USA. |
| 23 | * |
| 24 | *********************************************************************/ |
| 25 | |
| 26 | #ifndef __KASUMI_DIC_HXX__ |
| 27 | #define __KASUMI_DIC_HXX__ |
| 28 | |
| 29 | #ifdef HAVE_CONFIG_H |
| 30 | #include "config.h" |
| 31 | #endif |
| 32 | |
| 33 | #include <string> |
| 34 | #include <vector> |
| 35 | #include <list> |
| 36 | #include "KasumiWord.hxx" |
| 37 | #include "KasumiException.hxx" |
| 38 | #include "KasumiDicEventListener.hxx" |
| 39 | #include "KasumiWordEventListener.hxx" |
| 40 | #include "KasumiConfiguration.hxx" |
| 41 | |
| 42 | #define ERROR 0 |
| 43 | #define VALID 1 |
| 44 | |
| 45 | using namespace std; |
| 46 | |
| 47 | class KasumiDic : public KasumiWordEventListener{ |
| 48 | private: |
| 49 | list<KasumiWord*> mWordList; |
| 50 | vector<KasumiDicEventListener*> EventListeners; |
| 51 | |
| 52 | void load(KasumiConfiguration *conf) throw (KasumiException); |
| 53 | public: |
| 54 | KasumiDic(KasumiConfiguration *conf) |
| 55 | throw(KasumiException); |
| 56 | ~KasumiDic(); |
| 57 | void store() throw(KasumiException); |
| 58 | void appendWord(KasumiWord *word); // returns this word's ID |
| 59 | void removeWord(unsigned int id); |
| 60 | |
| 61 | void registerEventListener(KasumiDicEventListener *listener); |
| 62 | void removeEventListener(KasumiDicEventListener *listener); |
| 63 | |
| 64 | list<KasumiWord*>::iterator firstWordIter(){ return mWordList.begin(); }; |
| 65 | list<KasumiWord*>::iterator endWordIter(){ return mWordList.end(); }; |
| 66 | |
| 67 | void changedFrequency(KasumiWord *word); |
| 68 | void changedSpelling(KasumiWord *word); |
| 69 | void changedSound(KasumiWord *word); |
| 70 | void changedWordType(KasumiWord *word); |
| 71 | |
| 72 | // KasumiWord *getWordWithID(unsigned int id) throw(KasumiException); |
| 73 | // int getUpperBoundOfWordID(); |
| 74 | }; |
| 75 | |
| 76 | #endif |