summaryrefslogtreecommitdiffstats
path: root/src/storage/phrase_large_table.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2010-08-19 14:17:41 +0800
committerPeng Wu <alexepico@gmail.com>2010-08-19 14:17:41 +0800
commit9822563242af16a1e8de2aa83bcd3c65dad1ed97 (patch)
tree120c43d36f4ba7233caff45540e339dd89b5f778 /src/storage/phrase_large_table.h
parent6f3ee371d7118ac04327a7654a519657e8981edd (diff)
downloadlibpinyin-9822563242af16a1e8de2aa83bcd3c65dad1ed97.tar.gz
libpinyin-9822563242af16a1e8de2aa83bcd3c65dad1ed97.tar.xz
libpinyin-9822563242af16a1e8de2aa83bcd3c65dad1ed97.zip
add phrase index table interface
Diffstat (limited to 'src/storage/phrase_large_table.h')
-rw-r--r--src/storage/phrase_large_table.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/storage/phrase_large_table.h b/src/storage/phrase_large_table.h
new file mode 100644
index 0000000..d6373c9
--- /dev/null
+++ b/src/storage/phrase_large_table.h
@@ -0,0 +1,44 @@
+/*
+ * libpinyin
+ * Library to deal with pinyin.
+ *
+ * Copyright (C) 2010 Peng Wu
+ *
+ * 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 PHRASE_LARGE_TABLE_H
+#define PHRASE_LARGE_TABLE_H
+
+class PhraseLargeTable{
+protected:
+ MemoryChunk * m_chunk;
+
+public:
+ /* load/store method */
+ bool load(MemoryChunk * chunk);
+ bool store(MemoryChunk * new_chunk);
+
+ bool load_text(FILE * file);
+
+ /* search/add_index/remove_index method */
+ int search( int phrase_length, /* in */ utf16_t phrase[],
+ /* out */ phrase_token_t & token);
+
+ int add_index( int phrase_length, /* in */ utf16_t phrase[], /* in */ phrase_token_t token);
+ int remove_index( int phrase_length, /* in */ utf16_t phrase[], /* out */ phrase_token_t & token);
+};
+
+#endif