| |
---|
| | : IMEngineInstanceBase (factory, encoding, id) |
---|
| | { |
---|
| | m_iconv.set_encoding ("EUC-JP"); |
---|
| | |
---|
| | // 初期化へ。 |
---|
| | loadPlugins(); |
---|
| | init(); |
---|
| | } |
---|
| | |
---|
| | HonokaInstance::~HonokaInstance() |
---|
| | { |
---|
| | for(unsigned int i = 0;i < plugins.size();i ++) { |
---|
| | plugins[i].deleteInstance(plugins[i].instance); |
---|
| | dlclose(plugins[i].dll); |
---|
| | } |
---|
| | delete acpredictor; |
---|
| | } |
---|
| | |
---|
| | /*! |
---|
| | \fn HonokaInstance::split(const String &str,const char &sep) |
---|
| | */ |
---|
| | vector<String> HonokaInstance::split(const String &str,const char &sep) |
---|
| | { |
---|
| | vector<String> s; |
---|
| | String w; |
---|
| | for(unsigned int i = 0;i < str.length();i ++) { |
---|
| | if (str[i] == sep) { |
---|
| | if (w.length()) { |
---|
| | s.push_back(w); |
---|
| | w.clear(); |
---|
| | } |
---|
| | } else w = w + str.substr(i,1); |
---|
| | } |
---|
| | if (w.length()) s.push_back(w); |
---|
| | return s; |
---|
| | } |
---|
| | |
---|
| | bool HonokaInstance::pluginCheck(HonokaPluginBase *p) { |
---|
| | |
---|
| | // Convertorの場合。 |
---|
| | if (p->getPluginType() == "Convertor") { |
---|
| | convertors.push_back(static_cast<Convertor *>(p)); |
---|
| | return true; |
---|
| | } else |
---|
| | // PreEditorの場合。 |
---|
| | if (p->getPluginType() == "PreEditor") { |
---|
| | preeditors.push_back(static_cast<PreEditor *>(p)); |
---|
| | return true; |
---|
| | } else |
---|
| | // Predictorの場合。 |
---|
| | if (p->getPluginType() == "Predictor") { |
---|
| | predictors.push_back(static_cast<Predictor *>(p)); |
---|
| | return true; |
---|
| | } |
---|
| | return false; |
---|
| | } |
---|
| | |
---|
| | |
---|
| | /*! |
---|
| | \fn HonokaInstance::loadPlugins() |
---|
| | */ |
---|
| | void HonokaInstance::loadPlugins() |
---|
| | { |
---|
| | DIR *dir = opendir(HONOKA_PLUGINDIR); |
---|
| | if (dir) { |
---|
| | struct dirent *entry; |
---|
| | // |
---|
| |
---|
| | m_predictor = predictors.at(0); |
---|
| | |
---|
| | m_multi = new MultiConvertor(_scim_config,this); |
---|
| | |
---|
| | // 初期化へ。 |
---|
| | init(); |
---|
| | } |
---|
| | bool HonokaInstance::pluginCheck(HonokaPluginBase *p) { |
---|
| | |
---|
| | // Convertorの場合。 |
---|
| | if (p->getPluginType() == "Convertor") { |
---|
| | convertors.push_back(static_cast<Convertor *>(p)); |
---|
| | return true; |
---|
| | } else |
---|
| | // PreEditorの場合。 |
---|
| | if (p->getPluginType() == "PreEditor") { |
---|
| | preeditors.push_back(static_cast<PreEditor *>(p)); |
---|
| | return true; |
---|
| | } else |
---|
| | // Predictorの場合。 |
---|
| | if (p->getPluginType() == "Predictor") { |
---|
| | predictors.push_back(static_cast<Predictor *>(p)); |
---|
| | return true; |
---|
| | } |
---|
| | return false; |
---|
| | } |
---|
| | |
---|
| | HonokaInstance::~HonokaInstance() |
---|
| | { |
---|
| | for(unsigned int i = 0;i < plugins.size();i ++) { |
---|
| | plugins[i].deleteInstance(plugins[i].instance); |
---|
| | dlclose(plugins[i].dll); |
---|
| | } |
---|
| | delete acpredictor; |
---|
| | } |
---|
| | |
---|
| | /*! |
---|
| | \fn HonokaInstance::split(const String &str,const char &sep) |
---|
| | */ |
---|
| | vector<String> HonokaInstance::split(const String &str,const char &sep) |
---|
| | { |
---|
| | vector<String> s; |
---|
| | String w; |
---|
| | for(unsigned int i = 0;i < str.length();i ++) { |
---|
| | if (str[i] == sep) { |
---|
| | if (w.length()) { |
---|
| | s.push_back(w); |
---|
| | w.clear(); |
---|
| | } |
---|
| | } else w = w + str.substr(i,1); |
---|
| | } |
---|
| | if (w.length()) s.push_back(w); |
---|
| | return s; |
---|
| | return; |
---|
| | } |
---|
| | |
---|
| | |
---|
| | /*! |
---|
| |
---|
| | |