Open Chinese Convert 1.0.3 A project for conversion between Traditional and Simplified Chinese

- Main Page
- Modules
- Classes
- Examples

opencc.h
1 /*
2 * Open Chinese Convert
3 *
4 * Copyright 2010-2014 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 __OPENCC_H_
20 #define __OPENCC_H_
21
22 #ifdef __cplusplus
23
24 #include <string>
25 #include "Export.hpp"
26 #include "SimpleConverter.hpp"
27
28 extern "C" {
29 #else
30 #include <stddef.h>
31 #endif
32
33 #ifndef OPENCC_EXPORT
34 #define OPENCC_EXPORT
35 #endif
36
48 #define OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD "s2t.json"
49
55 #define OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP "t2s.json"
56
62 typedef void* opencc_t;
63
73 OPENCC_EXPORT opencc_t opencc_open(const char* configFileName);
74
82 OPENCC_EXPORT int opencc_close(opencc_t opencc);
83
98 OPENCC_EXPORT size_t opencc_convert_utf8_to_buffer(opencc_t opencc,
99 const char* input,
100 size_t length,
101 char* output);
102
118 OPENCC_EXPORT char* opencc_convert_utf8(opencc_t opencc,
119 const char* input,
120 size_t length);
121
129 OPENCC_EXPORT void opencc_convert_utf8_free(char* str);
130
138 OPENCC_EXPORT const char* opencc_error(void);
139
140 #ifdef __cplusplus
141 } // extern "C"
142 #endif
143
150 #endif
opencc_close
OPENCC_EXPORT int opencc_close(opencc_t opencc)
Destroys an instance of opencc.
Definition: SimpleConverter.cpp:98
opencc_convert_utf8_to_buffer
OPENCC_EXPORT size_t opencc_convert_utf8_to_buffer(opencc_t opencc, const char *input, size_t length, char *output)
Converts UTF-8 string.
Definition: SimpleConverter.cpp:109
opencc_convert_utf8
OPENCC_EXPORT char * opencc_convert_utf8(opencc_t opencc, const char *input, size_t length)
Converts UTF-8 string This function returns an allocated C-Style string, which stores the converted s...
Definition: SimpleConverter.cpp:120
opencc_t
void * opencc_t
Type of opencc descriptor.
Definition: opencc.h:62
opencc_open
OPENCC_EXPORT opencc_t opencc_open(const char *configFileName)
Makes an instance of opencc.
Definition: SimpleConverter.cpp:85
opencc
Definition: BinaryDict.hpp:24
opencc_error
OPENCC_EXPORT const char * opencc_error(void)
Returns the last error message.
Definition: SimpleConverter.cpp:136
opencc_convert_utf8_free
OPENCC_EXPORT void opencc_convert_utf8_free(char *str)
Releases allocated buffer by opencc_convert_utf8.
Definition: SimpleConverter.cpp:134