add phrase index table interface
authorPeng Wu <alexepico@gmail.com>
Thu, 19 Aug 2010 06:17:41 +0000 (14:17 +0800)
committerPeng Wu <alexepico@gmail.com>
Thu, 19 Aug 2010 06:17:41 +0000 (14:17 +0800)
src/storage/phrase_large_table.h [new file with mode: 0644]
src/storage/pinyin_large_table.h

diff --git a/src/storage/phrase_large_table.h b/src/storage/phrase_large_table.h
new file mode 100644 (file)
index 0000000..d6373c9
--- /dev/null
@@ -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
index fd11aef..c1e6247 100755 (executable)
@@ -128,7 +128,7 @@ public:
        reset();
     }
 
-    /*load/save method*/
+    /* load/store method */
     bool load(MemoryChunk * chunk){
        reset();
        m_chunk = chunk;
@@ -147,16 +147,17 @@ public:
     }
 */
     
-    /*search/add_index method */
+    /* search/add_index/remove_index method */
     int search( int phrase_length, /* in */ PinyinKey keys[],
                /* out */ PhraseIndexRanges ranges){
        return m_bitmap_table.search(phrase_length, keys, ranges);
     }
 
-    int add_index( int phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token){
+    int add_index( int phrase_length, /* in */ PinyinKey keys[]/* in */ phrase_token_t token){
        return m_bitmap_table.add_index(phrase_length, keys, token);
     }
-    int remove_index( int phrase_length, /* in */ PinyinKey keys[] ,/* in */ phrase_token_t token){
+
+    int remove_index( int phrase_length, /* in */ PinyinKey keys[], /* in */ phrase_token_t token){
        return m_bitmap_table.remove_index(phrase_length, keys, token);
     }