summaryrefslogtreecommitdiffstats
path: root/src/storage/chewing_large_table2.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-02-25 11:12:49 +0800
committerPeng Wu <alexepico@gmail.com>2016-02-25 11:12:49 +0800
commit71895122df40eaec777d5033b02e3da3f9ef47f7 (patch)
tree06dcfec6367aad13d04c1fda5d9d5609ad99f6e1 /src/storage/chewing_large_table2.h
parent1366b0518ab211e7e48901851afa9373f4668c8f (diff)
downloadlibpinyin-71895122df40eaec777d5033b02e3da3f9ef47f7.tar.gz
libpinyin-71895122df40eaec777d5033b02e3da3f9ef47f7.tar.xz
libpinyin-71895122df40eaec777d5033b02e3da3f9ef47f7.zip
declare class ChewingTableEntry
Diffstat (limited to 'src/storage/chewing_large_table2.h')
-rw-r--r--src/storage/chewing_large_table2.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/storage/chewing_large_table2.h b/src/storage/chewing_large_table2.h
new file mode 100644
index 0000000..d31ef97
--- /dev/null
+++ b/src/storage/chewing_large_table2.h
@@ -0,0 +1,62 @@
+/*
+ * libpinyin
+ * Library to deal with pinyin.
+ *
+ * Copyright (C) 2016 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CHEWING_LARGE_TABLE2_H
+#define CHEWING_LARGE_TABLE2_H
+
+#include "novel_types.h"
+#include "memory_chunk.h"
+#include "chewing_key.h"
+
+namespace pinyin{
+
+template<size_t phrase_length>
+class ChewingTableEntry{
+ friend class ChewingLargeTable2;
+protected:
+ MemoryChunk m_chunk;
+
+private:
+ /* Disallow used outside. */
+ ChewingTableEntry() {}
+
+public:
+ /* search method */
+ int search(/* in */ const ChewingKey keys[],
+ /* out */ PhraseIndexRanges ranges) const;
+
+ /* add/remove index method */
+ int add_index(/* in */ const ChewingKey keys[],
+ /* in */ phrase_token_t token);
+ int remove_index(/* in */ const ChewingKey keys[],
+ /* in */ phrase_token_t token);
+
+ /* get length method */
+ int get_length() const;
+
+ /* mask out method */
+ bool mask_out(phrase_token_t mask, phrase_token_t value);
+
+};
+
+};
+
+#endif