begin to write libpinyin backend
[platform/upstream/ibus-libpinyin.git] / src / PYLibPinyin.h
1 /* vim:set et ts=4 sts=4:
2  *
3  * ibus-pinyin - The Chinese PinYin engine for IBus
4  *
5  * Copyright (c) 2011 Peng Wu <alexepico@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
22 #ifndef __PY_LIB_PINYIN_H_
23 #define __PY_LIB_PINYIN_H_
24
25 #include <memory>
26 #include <pinyin.h>
27
28 namespace PY {
29
30 class LibPinyinBackEnd{
31
32 public:
33     LibPinyinBackEnd();
34     ~LibPinyinBackEnd();
35
36     /* use static initializer in C++. */
37     static LibPinyinBackEnd & instance (void) { return *m_instance; }
38
39 private:
40     pinyin_context_t *m_pinyin_context; /* libpinyin context */
41
42 private:
43     static std::unique_ptr<LibPinyinBackEnd> m_instance;
44 };
45 };
46
47 #endif