diff --git a/honoka/libhonoka/predictor.cpp b/honoka/libhonoka/predictor.cpp index ad101b8..cee9f31 100644 --- a/honoka/libhonoka/predictor.cpp +++ b/honoka/libhonoka/predictor.cpp @@ -20,6 +20,22 @@ #include "predictor.h" +#ifdef HAVE_CONFIG_H + #include +#endif + +#ifdef HAVE_GETTEXT + #include + #define _(String) dgettext(GETTEXT_PACKAGE,String) + #define N_(String) (String) +#else + #define _(String) (String) + #define N_(String) (String) + #define bindtextdomain(Package,Directory) + #define textdomain(domain) + #define bind_textdomain_codeset(domain,codeset) +#endif + Predictor::Predictor(ConfigPointer cfg) : HonokaPluginBase(String("Predictor")) { } @@ -81,7 +97,7 @@ */ String Predictor::getName() { - return String("Predicter"); + return String(_("Predicter")); } diff --git a/honoka/plugins/Makefile.am b/honoka/plugins/Makefile.am index c542cb4..bb530f3 100644 --- a/honoka/plugins/Makefile.am +++ b/honoka/plugins/Makefile.am @@ -26,9 +26,9 @@ -DHONOKA_ICON_FILE=\"@SCIM_ICONDIR@/honoka.png\" \ -DHONOKA_PLUGINDIR=\"@SCIM_MODULEDIR@/honoka\" -noinst_HEADERS = wnnproto.h romkan.h \ - wnnconversion.h kanainput.h anthyconversion.h skkdic.h \ - skkdicconversion.h wnnplugin.h wnnprediction.h honoka_plugin_def.h +noinst_HEADERS = wnnproto.h romkan.h wnnconversion.h kanainput.h \ + anthyconversion.h skkdic.h skkdicconversion.h wnnplugin.h wnnprediction.h \ + honoka_plugin_def.h simpleprediction.h moduledir = @SCIM_MODULEDIR@/IMEngine @@ -42,7 +42,7 @@ endif plugindir = @SCIM_MODULEDIR@/honoka -plugin_LTLIBRARIES = $(ANTHY_PLUGIN) $(WNN_PLUGIN) plugin-skkdic.la plugin-romkan.la plugin-kanainput.la +plugin_LTLIBRARIES = $(ANTHY_PLUGIN) $(WNN_PLUGIN) plugin-skkdic.la plugin-romkan.la plugin-kanainput.la plugin-simpleprediction.la plugin_anthy_la_SOURCES = anthyconversion.cpp plugin_anthy_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ @@ -74,3 +74,10 @@ plugin_kanainput_la_LDFLAGS = -avoid-version -module -rpath $(plugindir) @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ plugin_kanainput_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la +plugin_simpleprediction_la_SOURCES = simpleprediction.cpp +plugin_simpleprediction_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ +plugin_simpleprediction_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ +plugin_simpleprediction_la_LDFLAGS = -avoid-version -module -rpath $(plugindir) @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ +plugin_simpleprediction_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la + + diff --git a/honoka/plugins/simpleprediction.cpp b/honoka/plugins/simpleprediction.cpp new file mode 100644 index 0000000..73d0efe --- /dev/null +++ b/honoka/plugins/simpleprediction.cpp @@ -0,0 +1,128 @@ +/*************************************************************************** + * Copyright (C) 2005 by TAM(Teppei Tamra) * + * tam-t@par.odn.ne.jp * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "simpleprediction.h" + +#ifdef HAVE_CONFIG_H + #include +#endif + +#ifdef HAVE_GETTEXT + #include + #define _(String) dgettext(GETTEXT_PACKAGE,String) + #define N_(String) (String) +#else + #define _(String) (String) + #define N_(String) (String) + #define bindtextdomain(Package,Directory) + #define textdomain(domain) + #define bind_textdomain_codeset(domain,codeset) +#endif + +// �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� +HonokaPluginRegister(SimplePrediction); + + +SimplePrediction::SimplePrediction(ConfigPointer cfg) : Predictor(cfg) +{ +} + + +SimplePrediction::~SimplePrediction() +{ +} + + + +/*! + \fn SimplePrediction::getPredictionList(const WideString &str) + */ +ResultList SimplePrediction::getPredictionList(const WideString &str) +{ + multimap tmp; + for(multimap::iterator it = data.begin();it != data.end();it ++) { + if (it->first.length() >= str.length()) { + if (str == it->first.substr(0,str.length())) tmp.insert(*it); + } + } + if (!tmp.size()) return ResultList(); + ResultList l; + l.kType = 3; + //for(unsigned int i = 0;i < tmp.size();i ++) { + for(multimap::iterator it = tmp.begin();it != tmp.end();it ++) { + l.kouho.push_back(ResultEntry(it->second)); + } + return l; +} + + +/*! + \fn SimplePrediction::disconnect() + */ +void SimplePrediction::disconnect() +{ + return; +} + + +/*! + \fn SimplePrediction::connect() + */ +bool SimplePrediction::connect() +{ + return true; +} + + +/*! + \fn SimplePrediction::isConnected() + */ +bool SimplePrediction::isConnected() +{ + return true; +} + + +/*! + \fn SimplePrediction::getPropertyName() + */ +String SimplePrediction::getPropertyName() +{ + return getName(); +} + +/*! + \fn SimplePrediction::getName() + */ +String SimplePrediction::getName() +{ + return String(_("SimplePrediction")); +} + +/*! + \fn SimplePrediction::update(const WideString str,const WideString yomi) + */ +void SimplePrediction::update(const WideString str,const WideString yomi) +{ + if ((!yomi.length()) || (!str.length())) return; + data.insert(pair(yomi,str)); + return; +} + diff --git a/honoka/plugins/simpleprediction.h b/honoka/plugins/simpleprediction.h new file mode 100644 index 0000000..2df9e4d --- /dev/null +++ b/honoka/plugins/simpleprediction.h @@ -0,0 +1,58 @@ +/*************************************************************************** + * Copyright (C) 2005 by TAM(Teppei Tamra) * + * tam-t@par.odn.ne.jp * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef SIMPLEPREDICTION_H +#define SIMPLEPREDICTION_H + + +#define Uses_SCIM_CONFIG_BASE + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/** +@author TAM (Teppei Tamra) +*/ +class SimplePrediction : public Predictor { +public: + SimplePrediction(ConfigPointer cfg); + + ~SimplePrediction(); + virtual ResultList getPredictionList(const WideString &str); + virtual void disconnect(); + virtual bool connect(); + virtual bool isConnected(); + virtual String getPropertyName(); + virtual String getName(); + virtual void update(const WideString str,const WideString yomi); + +protected: + multimap data; +}; + +#endif diff --git a/honoka/po/POTFILES.in b/honoka/po/POTFILES.in index 8485ba5..dc916f5 100644 --- a/honoka/po/POTFILES.in +++ b/honoka/po/POTFILES.in @@ -13,6 +13,8 @@ plugins/wnnprediction.cpp plugins/anthyconversion.h plugins/anthyconversion.cpp +plugins/simpleprediction.h +plugins/simpleprediction.cpp libhonoka/preeditor.h libhonoka/preeditor.cpp libhonoka/convertor.h diff --git a/honoka/po/honoka.pot b/honoka/po/honoka.pot index 8605569..192f44f 100644 --- a/honoka/po/honoka.pot +++ b/honoka/po/honoka.pot @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-06-24 15:27+0900\n" +"POT-Creation-Date: 2005-06-24 20:14+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -523,3 +523,11 @@ #: plugins/wnnprediction.cpp:98 msgid "WnnPrediction" msgstr "" + +#: plugins/simpleprediction.cpp:112 +msgid "SimplePrediction" +msgstr "" + +#: libhonoka/predictor.cpp:96 +msgid "Predicter" +msgstr "" diff --git a/honoka/po/ja.po b/honoka/po/ja.po index daa9dc0..2d63267 100644 --- a/honoka/po/ja.po +++ b/honoka/po/ja.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: ja\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-06-24 15:27+0900\n" +"POT-Creation-Date: 2005-06-24 20:14+0900\n" "PO-Revision-Date: 2004-12-01 14:29+0900\n" "Last-Translator: TAM (Teppei Tamra) \n" "Language-Team: Japanese\n" @@ -526,5 +526,13 @@ msgid "WnnPrediction" msgstr "Wnn予測" +#: plugins/simpleprediction.cpp:112 +msgid "SimplePrediction" +msgstr "単純予測" + +#: libhonoka/predictor.cpp:96 +msgid "Predicter" +msgstr "予測なし" + #~ msgid "Wnn" #~ msgstr "Wnn"