summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-03-14 14:48:32 +0800
committerPeng Wu <alexepico@gmail.com>2012-03-14 14:49:41 +0800
commitfc5b1e375f9c923187175fc12e42720d620db3c6 (patch)
tree3eb0abc651c1de7ab97b30b04e38c9e8ef696f34
parent9be8757a0609be90919e81d8df0176e489f6b274 (diff)
downloadlibpinyin-fc5b1e375f9c923187175fc12e42720d620db3c6.tar.gz
libpinyin-fc5b1e375f9c923187175fc12e42720d620db3c6.tar.xz
libpinyin-fc5b1e375f9c923187175fc12e42720d620db3c6.zip
update facade_phrase_table.h
-rw-r--r--src/storage/facade_phrase_table.h67
1 files changed, 62 insertions, 5 deletions
diff --git a/src/storage/facade_phrase_table.h b/src/storage/facade_phrase_table.h
index 7ff3a70..d3acde3 100644
--- a/src/storage/facade_phrase_table.h
+++ b/src/storage/facade_phrase_table.h
@@ -26,19 +26,39 @@
namespace pinyin{
+/**
+ * FacadePhraseTable:
+ *
+ * The facade class of phrase large table.
+ *
+ */
+
class FacadePhraseTable{
private:
PhraseLargeTable * m_system_phrase_table;
PhraseLargeTable * m_user_phrase_table;
public:
- /* constructor/destructor */
+ /**
+ * FacadePhraseTable::FacadePhraseTable:
+ *
+ * The constructor of the FacadePhraseTable.
+ *
+ */
FacadePhraseTable() {
m_system_phrase_table = NULL;
m_user_phrase_table = NULL;
}
- /* load/store methods */
+ /**
+ * FacadePhraseTable::load:
+ * @system: the memory chunk of the system phrase table.
+ * @user: the memory chunk of the user phrase table.
+ * @returns: whether the load operation is successful.
+ *
+ * Load the system or user phrase table from the memory chunks.
+ *
+ */
bool load(MemoryChunk * system, MemoryChunk * user) {
bool result = false;
if (system) {
@@ -52,12 +72,30 @@ public:
return result;
}
+ /**
+ * FacadePhraseTable::store:
+ * @new_user: the memory chunk to store the user phrase table.
+ * @returns: whether the store operation is successful.
+ *
+ * Store the user phrase table to the memory chunk.
+ *
+ */
bool store(MemoryChunk * new_user) {
- assert(NULL != m_user_phrase_table);
+ if (NULL == m_user_phrase_table)
+ return false;
return m_user_phrase_table->store(new_user);
}
- /* search method */
+ /**
+ * FacadePhraseTable::search:
+ * @phrase_length: the length of the phrase to be searched.
+ * @phrase: the ucs4 characters of the phrase to be searched.
+ * @token: the token to store the matched phrase.
+ * @returns: the search result of enum SearchResult.
+ *
+ * Search the phrase token according to the ucs4 characters.
+ *
+ */
int search(int phrase_length, /* in */ ucs4_t phrase[],
/* out */ phrase_token_t & token){
int result = SEARCH_NONE;
@@ -73,7 +111,16 @@ public:
return result;
}
- /* add/remove index method */
+ /**
+ * FacadePhraseTable::add_index:
+ * @phrase_length: the length of the phrase to be added.
+ * @phrase: the ucs4 characters of the phrase to be added.
+ * @token: the token of the phrase to be added.
+ * @returns: the add result of enum AddIndexResult.
+ *
+ * Add the phrase token to the user phrase table.
+ *
+ */
int add_index(int phrase_length, /* in */ ucs4_t phrase[],
/* in */ phrase_token_t token) {
assert(NULL != m_user_phrase_table);
@@ -81,6 +128,16 @@ public:
(phrase_length, phrase, token);
}
+ /**
+ * FacadePhraseTable::remove_index:
+ * @phrase_length: the length of the phrase to be removed.
+ * @phrase: the ucs4 characters of the phrase to be removed.
+ * @token: the token of the phrase to be removed.
+ * @returns: the remove result of enum RemoveIndexResult.
+ *
+ * Remove the phrase token from the user phrase table.
+ *
+ */
int remove_index(int phrase_length, /* in */ ucs4_t phrase[],
/* out */ phrase_token_t & token){
assert(NULL != m_user_phrase_table);