Open Chinese Convert 1.1.8
A project for conversion between Traditional and Simplified Chinese
|
Typedefs | |
typedef void * | opencc_t |
Type of opencc descriptor. | |
Functions | |
OPENCC_EXPORT opencc_t | opencc_open (const char *configFileName) |
Makes an instance of opencc. | |
OPENCC_EXPORT int | opencc_close (opencc_t opencc) |
Destroys an instance of opencc. | |
OPENCC_EXPORT size_t | opencc_convert_utf8_to_buffer (opencc_t opencc, const char *input, size_t length, char *output) |
Converts UTF-8 std::string. | |
OPENCC_EXPORT char * | opencc_convert_utf8 (opencc_t opencc, const char *input, size_t length) |
Converts UTF-8 std::string This function returns an allocated C-Style std::string, which stores the converted std::string. | |
OPENCC_EXPORT void | opencc_convert_utf8_free (char *str) |
Releases allocated buffer by opencc_convert_utf8. | |
OPENCC_EXPORT const char * | opencc_error (void) |
Returns the last error message. | |
API in C language
OPENCC_EXPORT int opencc_close | ( | opencc_t | opencc | ) |
Destroys an instance of opencc.
opencc | The description pointer. |
OPENCC_EXPORT char * opencc_convert_utf8 | ( | opencc_t | opencc, |
const char * | input, | ||
size_t | length ) |
Converts UTF-8 std::string This function returns an allocated C-Style std::string, which stores the converted std::string.
You MUST call opencc_convert_utf8_free() to release allocated memory.
opencc | The opencc description pointer. |
input | The UTF-8 encoded std::string. |
length | The maximum length in byte to convert. If length is (size_t)-1, the whole std::string (terminated by '\0') will be converted. |
OPENCC_EXPORT void opencc_convert_utf8_free | ( | char * | str | ) |
Releases allocated buffer by opencc_convert_utf8.
str | Pointer to the allocated std::string buffer by opencc_convert_utf8. |
OPENCC_EXPORT size_t opencc_convert_utf8_to_buffer | ( | opencc_t | opencc, |
const char * | input, | ||
size_t | length, | ||
char * | output ) |
Converts UTF-8 std::string.
opencc | The opencc description pointer. |
input | The UTF-8 encoded std::string. |
length | The maximum length in byte to convert. If length is (size_t)-1, the whole std::string (terminated by '\0') will be converted. |
output | The buffer to store converted text. You MUST make sure this buffer has sufficient space. |
OPENCC_EXPORT const char * opencc_error | ( | void | ) |
Returns the last error message.
Note that this function is the only one which is NOT thread-safe.
OPENCC_EXPORT opencc_t opencc_open | ( | const char * | configFileName | ) |
Makes an instance of opencc.
configFileName | Location of configuration file. If this is set to NULL, OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD will be loaded. |