diff options
author | Peng Wu <alexepico@gmail.com> | 2015-04-21 11:13:50 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2015-04-21 11:13:50 +0800 |
commit | fb3a0fa827098b9c2f8885e1e55e761deccdac1d (patch) | |
tree | a7952ea0963ccc115854bb59e2270744ec51b8e1 /src/storage/ngram.cpp | |
parent | 66e1956cedc8e0e33a900e843cfea842e4483a6a (diff) | |
download | libpinyin-fb3a0fa827098b9c2f8885e1e55e761deccdac1d.tar.gz libpinyin-fb3a0fa827098b9c2f8885e1e55e761deccdac1d.tar.xz libpinyin-fb3a0fa827098b9c2f8885e1e55e761deccdac1d.zip |
add copy parameter to single gram constructor
Diffstat (limited to 'src/storage/ngram.cpp')
-rw-r--r-- | src/storage/ngram.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/storage/ngram.cpp b/src/storage/ngram.cpp index 4f4e787..1c99948 100644 --- a/src/storage/ngram.cpp +++ b/src/storage/ngram.cpp @@ -39,8 +39,11 @@ SingleGram::SingleGram(){ memset(m_chunk.begin(), 0, sizeof(guint32)); } -SingleGram::SingleGram(void * buffer, size_t length){ - m_chunk.set_chunk(buffer, length, NULL); +SingleGram::SingleGram(void * buffer, size_t length, bool copy){ + if (copy) + m_chunk.set_content(0, buffer, length); + else + m_chunk.set_chunk(buffer, length, NULL); } bool SingleGram::get_total_freq(guint32 & total) const{ |