clean db
[platform/upstream/ibus-libpinyin.git] / src / PYSpecialPhraseTable.h
1 /* vim:set et ts=4 sts=4:
2  *
3  * ibus-pinyin - The Chinese PinYin engine for IBus
4  *
5  * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 #ifndef __PY_SPECIAL_PHRASE_TABLE_H_
22 #define __PY_SPECIAL_PHRASE_TABLE_H_
23
24 #include <map>
25 #include <string>
26 #include <vector>
27 #include <glib.h>
28 #include "PYUtil.h"
29
30 namespace PY {
31
32 class SpecialPhrase;
33 typedef std::shared_ptr<SpecialPhrase> SpecialPhrasePtr;
34
35 class SpecialPhraseTable {
36 private:
37     SpecialPhraseTable (void);
38
39 public:
40     gboolean lookup (const std::string &command, std::vector<std::string> &result);
41
42 private:
43     gboolean load (const gchar *file);
44
45 public:
46     static SpecialPhraseTable & instance (void) { return m_instance; }
47
48 private:
49     typedef std::multimap<std::string, SpecialPhrasePtr> Map;
50     Map m_map;
51
52 private:
53     static SpecialPhraseTable m_instance;
54 };
55
56 };
57
58 #endif