summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2014-09-18 16:59:43 +0800
committerPeng Wu <alexepico@gmail.com>2014-09-18 16:59:43 +0800
commit2a2ffe7d47726f389d331a9f0f694e094c7a4c14 (patch)
tree4b937d7b0cf31ab3f56916802a8ed4ee4fa549ab
parent1c2710c2ba49993030aa75edd6098f1855c45f7c (diff)
downloadibus-libzhuyin-2a2ffe7d47726f389d331a9f0f694e094c7a4c14.tar.gz
ibus-libzhuyin-2a2ffe7d47726f389d331a9f0f694e094c7a4c14.tar.xz
ibus-libzhuyin-2a2ffe7d47726f389d331a9f0f694e094c7a4c14.zip
import ZYSymbolLookup.h
-rw-r--r--src/ZYSymbolLookup.h49
-rw-r--r--src/ZYSymbols.cc3
2 files changed, 52 insertions, 0 deletions
diff --git a/src/ZYSymbolLookup.h b/src/ZYSymbolLookup.h
new file mode 100644
index 0000000..272ab3b
--- /dev/null
+++ b/src/ZYSymbolLookup.h
@@ -0,0 +1,49 @@
+/* vim:set et ts=4 sts=4:
+ *
+ * ibus-libzhuyin - New Zhuyin engine based on libzhuyin for IBus
+ *
+ * Copyright (c) 2014 Peng Wu <alexepico@gmail.com>
+ *
+ * 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, 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 __ZY_SYMBOL_LOOKUP_H_
+#define __ZY_SYMBOL_LOOKUP_H_
+
+#include "ZYString.h"
+#include <vector>
+#include <glib.h>
+
+class SymbolLookup {
+private:
+ typedef std::vector<String> symbol_vec_t;
+
+public:
+ SymbolLookup () {}
+ virtual ~SymbolLookup () {}
+
+ gboolean loadFromFile (const char * filename);
+
+ String find(const String index);
+ const std::vector<String> & getIndexes() { return m_indexes; }
+
+ void dumpInfo ();
+protected:
+ symbol_vec_t m_indexes;
+ symbol_vec_t m_symbols;
+};
+
+
+#endif
diff --git a/src/ZYSymbols.cc b/src/ZYSymbols.cc
index 0447467..9b850de 100644
--- a/src/ZYSymbols.cc
+++ b/src/ZYSymbols.cc
@@ -27,7 +27,10 @@ namespace ZY {
/* The following tables are copied from libchewing code. */
static const char G_EASY_SYMBOL_KEY[] = {
+#if 0
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+#endif
+ /* only capital letters are allowed here. */
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
'U', 'V', 'W', 'X', 'Y', 'Z'