rename PhraseIndexItem to PhraseIndexItem2
authorPeng Wu <alexepico@gmail.com>
Mon, 27 Aug 2012 02:59:32 +0000 (10:59 +0800)
committerPeng Wu <alexepico@gmail.com>
Mon, 27 Aug 2012 02:59:32 +0000 (10:59 +0800)
src/storage/phrase_large_table2.cpp

index cccb0c8..ad9c2bb 100644 (file)
@@ -50,9 +50,25 @@ public:
                      /* in */ phrase_token_t token);
 };
 
+
+template<size_t phrase_length>
+struct PhraseIndexItem2{
+    phrase_token_t m_token;
+    ucs4_t m_phrase[phrase_length];
+public:
+    PhraseIndexItem2<phrase_length>(ucs4_t phrase[], phrase_token_t token){
+        memmove(m_phrase, phrase, sizeof(ucs4_t) * phrase_length);
+        m_token = token;
+    }
+};
+
+
 template<size_t phrase_length>
 class PhraseArrayIndexLevel2{
 protected:
+    typedef PhraseIndexItem2<phrase_length> IndexItem;
+
+protected:
     MemoryChunk m_chunk;
 public:
     bool load(MemoryChunk * chunk, table_offset_t offset, table_offset_t end);
@@ -73,19 +89,8 @@ using namespace pinyin;
 /* class implementation */
 
 template<size_t phrase_length>
-struct PhraseIndexItem{
-    phrase_token_t m_token;
-    ucs4_t m_phrase[phrase_length];
-public:
-    PhraseIndexItem<phrase_length>(ucs4_t phrase[], phrase_token_t token){
-        memmove(m_phrase, phrase, sizeof(ucs4_t) * phrase_length);
-        m_token = token;
-    }
-};
-
-template<size_t phrase_length>
-static int phrase_compare(const PhraseIndexItem<phrase_length> &lhs,
-                          const PhraseIndexItem<phrase_length> &rhs){
+static int phrase_compare(const PhraseIndexItem2<phrase_length> &lhs,
+                          const PhraseIndexItem2<phrase_length> &rhs){
     ucs4_t * phrase_lhs = (ucs4_t *) lhs.m_phrase;
     ucs4_t * phrase_rhs = (ucs4_t *) rhs.m_phrase;
 
@@ -93,7 +98,7 @@ static int phrase_compare(const PhraseIndexItem<phrase_length> &lhs,
 }
 
 template<size_t phrase_length>
-static bool phrase_less_than(const PhraseIndexItem<phrase_length> & lhs,
-                             const PhraseIndexItem<phrase_length> & rhs){
+static bool phrase_less_than(const PhraseIndexItem2<phrase_length> & lhs,
+                             const PhraseIndexItem2<phrase_length> & rhs){
     return 0 > phrase_compare(lhs, rhs);
 }