#ifndef DICTIONARYSINGLETON_H #define DICTIONARYSINGLETON_H #include #include #ifndef WIN32 #include #else #include "OVUtility.h" #endif #include "OVSQLite3.h" #include "Vocabulary.h" using namespace std; class DictionarySingleton { public: static DictionarySingleton* getInstance( const char* dbFilePath) { if(itsInstance == NULL) itsInstance = new DictionarySingleton(dbFilePath); return itsInstance; } static void lostInstance(); void setInputMethodId(string id) { inputMethodId = id; if(inputMethodId == "PhoneticHsu") inputMethodId = "BoPoMoFo"; } bool isVocabulary(string characters); bool getVocabulariesByKeystrokes( string keystrokes, vector& vocabularyVectorRef); protected: DictionarySingleton(const char* dbFilePath); ~DictionarySingleton(); private: static DictionarySingleton* itsInstance; static SQLite3 *dictionaryDB; string inputMethodId; }; #endif