dc1c4745ed0dd390a5d9156757bd8e742102c752
[platform/upstream/libpinyin.git] / src / storage / table_info.h
1 /* 
2  *  libpinyin
3  *  Library to deal with pinyin.
4  *  
5  *  Copyright (C) 2013 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 of the License, or
10  *  (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20  */
21
22 #ifndef TABLE_INFO_H
23 #define TABLE_INFO_H
24
25 namespace pinyin{
26
27 class UserTableInfo;
28
29 class SystemTableInfo{
30     friend class UserTableInfo;
31 private:
32     int m_binary_format_version;
33     int m_model_data_version;
34     gfloat m_lambda;
35
36     pinyin_table_info_t m_table_info[PHRASE_INDEX_LIBRARY_COUNT];
37
38 private:
39     void reset();
40
41     void postfix_tables();
42
43 public:
44     SystemTableInfo();
45
46     ~SystemTableInfo();
47
48     bool load(const char * filename);
49
50     pinyin_table_info_t * get_table_info();
51
52     gfloat get_lambda();
53 };
54
55 class UserTableInfo{
56 private:
57     int m_binary_format_version;
58     int m_model_data_version;
59
60 public:
61     UserTableInfo();
62
63     bool load(const char * filename);
64
65     bool save(const char * filename);
66
67     bool is_conform(const SystemTableInfo * sysinfo);
68
69     bool make_conform(const SystemTableInfo * sysinfo);
70 };
71
72 };
73
74
75 #endif