diff options
| author | Peng Wu <alexepico@gmail.com> | 2010-08-19 14:17:41 +0800 |
|---|---|---|
| committer | Peng Wu <alexepico@gmail.com> | 2010-08-19 14:17:41 +0800 |
| commit | 9822563242af16a1e8de2aa83bcd3c65dad1ed97 (patch) | |
| tree | 120c43d36f4ba7233caff45540e339dd89b5f778 /src | |
| parent | 6f3ee371d7118ac04327a7654a519657e8981edd (diff) | |
add phrase index table interface
Diffstat (limited to 'src')
| -rw-r--r-- | src/storage/phrase_large_table.h | 44 | ||||
| -rwxr-xr-x | src/storage/pinyin_large_table.h | 9 |
2 files changed, 49 insertions, 4 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 diff --git a/src/storage/pinyin_large_table.h b/src/storage/pinyin_large_table.h index fd11aef..c1e6247 100755 --- a/src/storage/pinyin_large_table.h +++ b/src/storage/pinyin_large_table.h @@ -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); } |
