diff options
author | Peng Wu <alexepico@gmail.com> | 2016-01-18 11:13:34 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-01-18 11:13:34 +0800 |
commit | 9b3aad3a507b98bbccad3b37f97b7a9213ca7655 (patch) | |
tree | 3a50fe86b9f5a5d30fdbd7a714dd781c9ec5a246 | |
parent | ec35afec701df415f4617fd33a5ca1675c686c68 (diff) | |
download | libpinyin-9b3aad3a507b98bbccad3b37f97b7a9213ca7655.tar.gz libpinyin-9b3aad3a507b98bbccad3b37f97b7a9213ca7655.tar.xz libpinyin-9b3aad3a507b98bbccad3b37f97b7a9213ca7655.zip |
drop libdatrie depends
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/storage/phrase_large_table3.cpp | 39 | ||||
-rw-r--r-- | src/storage/phrase_large_table3.h | 4 |
4 files changed, 2 insertions, 46 deletions
diff --git a/configure.ac b/configure.ac index 0eda6ec..ef9bbfe 100644 --- a/configure.ac +++ b/configure.ac @@ -78,9 +78,6 @@ AC_CHECK_FUNCS([gettimeofday memmove memset setlocale]) AC_CHECK_HEADERS([libintl.h string.h]) -# Check Double Array Trie Tree -PKG_CHECK_MODULES(DATRIE, [datrie-0.2 >= 0.2]) - # Check Berkeley DB or Kyoto Cabinet DBM="BerkeleyDB" AC_ARG_WITH(dbm, diff --git a/src/Makefile.am b/src/Makefile.am index a675bb1..b38a980 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,7 +44,7 @@ noinst_LTLIBRARIES = libpinyin_internal.la libpinyin_la_SOURCES = pinyin.cpp -libpinyin_la_LIBADD = storage/libstorage.la lookup/liblookup.la @GLIB2_LIBS@ @DATRIE_LIBS@ +libpinyin_la_LIBADD = storage/libstorage.la lookup/liblookup.la @GLIB2_LIBS@ libpinyin_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libpinyin.ver \ -version-info @LT_VERSION_INFO@ diff --git a/src/storage/phrase_large_table3.cpp b/src/storage/phrase_large_table3.cpp index 4f9c692..12632ae 100644 --- a/src/storage/phrase_large_table3.cpp +++ b/src/storage/phrase_large_table3.cpp @@ -19,48 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <datrie/trie.h> #include "phrase_large_table3.h" namespace pinyin{ -void PhraseLargeTable3::reset() { - if (m_index) { - trie_free(m_index); - m_index = NULL; - } - if (m_content) { - delete m_content; - m_content = NULL; - } -} - -PhraseLargeTable3::PhraseLargeTable3() { - AlphaMap * map = alpha_map_new(); - /* include ucs4 characters. */ - alpha_map_add_range(map, 1, UINT_MAX); - m_index = trie_new(map); - alpha_map_free(map); - - m_content = new MemoryChunk; -} - -bool PhraseLargeTable3::load(FILE * index, MemoryChunk * content) { - reset(); - - m_index = trie_fread(index); - if (NULL == m_index) - return false; - m_content = content; - return true; -} - -bool PhraseLargeTable3::store(FILE * new_index, MemoryChunk * new_content) { - int retval = trie_fwrite(m_index, new_index); - if (retval) - return false; - new_content->set_content(0, m_content->begin(), m_content->size()); - return true; -} /* load text method */ diff --git a/src/storage/phrase_large_table3.h b/src/storage/phrase_large_table3.h index ab75c26..0a56753 100644 --- a/src/storage/phrase_large_table3.h +++ b/src/storage/phrase_large_table3.h @@ -26,14 +26,12 @@ #include "novel_types.h" #include "memory_chunk.h" -typedef struct _Trie Trie; namespace pinyin{ class PhraseLargeTable3{ protected: - Trie * m_index; - MemoryChunk * m_content; + /* member variables. */ void reset(); |