Open Chinese Convert  0.4.3
A project for conversion between Traditional and Simplified Chinese
 All Data Structures Files Functions Variables Groups Pages
dict_group.h
1 /*
2  * Open Chinese Convert
3  *
4  * Copyright 2010-2013 BYVoid <byvoid@byvoid.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef __DICTIONARY_GROUP_H_
20 #define __DICTIONARY_GROUP_H_
21 
22 #include "common.h"
23 #include "dict.h"
24 
25 typedef enum {
26  DICTIONARY_ERROR_VOID,
27  DICTIONARY_ERROR_NODICT,
28  DICTIONARY_ERROR_CANNOT_ACCESS_DICTFILE,
29  DICTIONARY_ERROR_INVALID_DICT,
30  DICTIONARY_ERROR_INVALID_INDEX,
31 } dictionary_error;
32 
33 DictGroup* dict_group_new(DictChain* t_DictChain);
34 
35 void dict_group_delete(DictGroup* dict_group);
36 
37 int dict_group_load(DictGroup* dict_group,
38  const char* filename,
39  opencc_dictionary_type type);
40 
41 const ucs4_t* const* dict_group_match_longest(
42  DictGroup* dict_group,
43  const ucs4_t* word,
44  size_t maxlen,
45  size_t* match_length);
46 
47 size_t dict_group_get_all_match_lengths(DictGroup* dict_group,
48  const ucs4_t* word,
49  size_t* match_length);
50 
51 Dict* dict_group_get_dict(DictGroup* dict_group, size_t index);
52 
53 dictionary_error dictionary_errno(void);
54 
55 void dictionary_perror(const char* spec);
56 
57 #endif /* __DICTIONARY_GROUP_H_ */