diff options
| author | Peng Wu <alexepico@gmail.com> | 2016-01-27 12:03:28 +0800 |
|---|---|---|
| committer | Peng Wu <alexepico@gmail.com> | 2016-01-27 12:11:06 +0800 |
| commit | 65276d8bef358c3d74957ac07a06cbfaa4ebed0b (patch) | |
| tree | 0487aaec32312e07a70cc47933081f33b857c651 /src | |
| parent | 8a69df17c20e7b09fc91856d6653ff52b5f297aa (diff) | |
| download | libpinyin-65276d8bef358c3d74957ac07a06cbfaa4ebed0b.tar.gz libpinyin-65276d8bef358c3d74957ac07a06cbfaa4ebed0b.tar.xz libpinyin-65276d8bef358c3d74957ac07a06cbfaa4ebed0b.zip | |
refactor PhraseLargeTable3
Diffstat (limited to 'src')
| -rw-r--r-- | src/storage/facade_phrase_table3.h | 4 | ||||
| -rw-r--r-- | src/storage/phrase_large_table3_bdb.h | 5 | ||||
| -rw-r--r-- | src/storage/phrase_large_table3_kyotodb.h | 5 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/storage/facade_phrase_table3.h b/src/storage/facade_phrase_table3.h index c9f597c..f7b3c80 100644 --- a/src/storage/facade_phrase_table3.h +++ b/src/storage/facade_phrase_table3.h @@ -79,8 +79,8 @@ public: bool result = false; if (system_filename) { m_system_phrase_table = new PhraseLargeTable3; - result = m_system_phrase_table->load - (system_filename) || result; + result = m_system_phrase_table->attach + (system_filename, ATTACH_READONLY) || result; } if (user_filename) { m_user_phrase_table = new PhraseLargeTable3; diff --git a/src/storage/phrase_large_table3_bdb.h b/src/storage/phrase_large_table3_bdb.h index e3ebb2b..8610607 100644 --- a/src/storage/phrase_large_table3_bdb.h +++ b/src/storage/phrase_large_table3_bdb.h @@ -45,13 +45,16 @@ public: reset(); } + /* attach method */ + bool attach(const char * dbfile, guint32 flags); + /* load/store method */ /* use in-memory DBM here, for better performance. */ bool load(const char * filename); bool store(const char * new_filename); - bool load_text(FILE * file); + bool load_text(FILE * infile); /* search method */ int search(int phrase_length, /* in */ const ucs4_t phrase[], diff --git a/src/storage/phrase_large_table3_kyotodb.h b/src/storage/phrase_large_table3_kyotodb.h index deb83e8..fa76ffe 100644 --- a/src/storage/phrase_large_table3_kyotodb.h +++ b/src/storage/phrase_large_table3_kyotodb.h @@ -45,13 +45,16 @@ public: reset(); } + /* attach method */ + bool attach(const char * dbfile, guint32 flags); + /* load/store method */ /* use in-memory DBM here, for better performance. */ bool load(const char * filename); bool store(const char * new_filename); - bool load_text(FILE * file); + bool load_text(FILE * infile); /* search method */ int search(int phrase_length, /* in */ const ucs4_t phrase[], |
