Open Chinese Convert  0.4.3
A project for conversion between Traditional and Simplified Chinese
 All Data Structures Files Functions Variables Groups Pages
converter.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 __CONVERTER_H_
20 #define __CONVERTER_H_
21 
22 #include "common.h"
23 #include "dict_chain.h"
24 
25 typedef enum {
26  CONVERTER_ERROR_VOID,
27  CONVERTER_ERROR_NODICT,
28  CONVERTER_ERROR_OUTBUF,
29 } converter_error;
30 
31 void converter_assign_dictionary(Converter* converter, DictChain* DictChain);
32 
33 Converter* converter_open(void);
34 
35 void converter_close(Converter* converter);
36 
37 size_t converter_convert(Converter* converter,
38  ucs4_t** inbuf,
39  size_t* inbuf_left,
40  ucs4_t** outbuf,
41  size_t* outbuf_left);
42 
43 void converter_set_conversion_mode(Converter* converter,
44  opencc_conversion_mode conversion_mode);
45 
46 converter_error converter_errno(void);
47 
48 void converter_perror(const char* spec);
49 
50 #endif /* __CONVERTER_H_ */