From: Peng Huang Date: Wed, 14 Apr 2010 11:05:34 +0000 (+0800) Subject: Change special_phrases format X-Git-Tag: 1.3.10~222 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b09a2d9d16d805c1b9ad8a5d35178f75441e3dc;p=platform%2Fupstream%2Fibus-libpinyin.git Change special_phrases format --- diff --git a/src/SpecialTable.cc b/src/SpecialTable.cc index 276fe14..3a5523a 100644 --- a/src/SpecialTable.cc +++ b/src/SpecialTable.cc @@ -37,7 +37,7 @@ public: while (s != 2) { switch (s) { case 0: - pnext = m_text.find ("%(", pos); + pnext = m_text.find ("${", pos); if (pnext == m_text.npos) { result += m_text.substr (pos); s = 2; @@ -49,9 +49,9 @@ public: } break; case 1: - pnext = m_text.find (")", pos); + pnext = m_text.find ("}", pos); if (pnext == m_text.npos) { - result += "%("; + result += "${"; result += m_text.substr (pos); s = 2; } @@ -68,9 +68,9 @@ public: return result; } - const std::string dec (gint d) { + const std::string dec (gint d, const gchar *fmt = "%d") { char string [32]; - std::snprintf (string, sizeof (string), "%d", d); + std::snprintf (string, sizeof (string), fmt, d); return string; } @@ -129,7 +129,6 @@ SpecialTable::load (const gchar *file) getline (in, line); size_t pos = line.find ('\t'); if (pos == line.npos) { - std::cerr << "error: " << line << std::endl; continue; } std::string command = line.substr(0, pos); @@ -145,12 +144,14 @@ SpecialTable::load (const gchar *file) return TRUE; } +#if 0 static bool phraseCmp (const SpecialPhrase *first, const SpecialPhrase *second) { return first->position () <= second->position (); } +#endif void SpecialTable::insert (const std::string &command, diff --git a/src/special_phrases b/src/special_phrases index 818781f..27f437c 100644 --- a/src/special_phrases +++ b/src/special_phrases @@ -22,11 +22,11 @@ kalaok 卡拉OK pcji PC机 qiruiqq 奇瑞QQ qqhao QQ号 -rq %(year)年%(month)月%(day)日 -rq %(year)-%(month)-%(day) +rq ${year}年${month}月${day}日 +rq ${year}-${month}-${day} simka SIM卡 -sj %(hour_24)时%(minute)分%(second)秒 -sj %(hour_24):%(minute):%(second) +sj ${hour_24}时${minute}分${second}秒 +sj ${hour_24}:${minute}:${second} tixu T恤 tixushan T恤衫 txingtai T型台