tetengo 1.8.1
A multipurpose library set
|
An encoder. More...
#include <stddef.h>
Go to the source code of this file.
Typedefs | |
typedef enum tetengo_text_encoder_encoding_tag | tetengo_text_encoder_encoding_t |
Enumerations | |
enum | tetengo_text_encoder_encoding_tag { tetengo_text_encoder_encoding_utf8 , tetengo_text_encoder_encoding_utf16 , tetengo_text_encoder_encoding_cp932 } |
Functions | |
const tetengo_text_encoder_t * | tetengo_text_encoder_instance (tetengo_text_encoder_encoding_t encoding) |
Returns the encoder instance. | |
size_t | tetengo_text_encoder_encode (const tetengo_text_encoder_t *p_encoder, const char *string, char *encoded_string, size_t encoded_string_capacity) |
Encodes a string. | |
size_t | tetengo_text_encoder_decode (const tetengo_text_encoder_t *p_encoder, const char *encoded_string, char *string, size_t string_capacity) |
Decodes a string. | |
An encoder.
Copyright (C) 2019-2023 kaoru https://www.tetengo.org/
Encoding type
size_t tetengo_text_encoder_decode | ( | const tetengo_text_encoder_t * | p_encoder, |
const char * | encoded_string, | ||
char * | string, | ||
size_t | string_capacity | ||
) |
Decodes a string.
When decoding from UTF-16, cast unsigned short[] to char* for encoded_string.
p_encoder | A pointer to an encoder. |
encoded_string | An encoded string. |
string | The storage for a string. Can be NULL. |
string_capacity | The capacity of string including a terminator '\0'. |
size_t tetengo_text_encoder_encode | ( | const tetengo_text_encoder_t * | p_encoder, |
const char * | string, | ||
char * | encoded_string, | ||
size_t | encoded_string_capacity | ||
) |
Encodes a string.
When encoding to UTF-16, cast unsigned short[] to char* for encoded_string and the unit of encoded_string_capacity and the return value is an unsigned short character.
p_encoder | A pointer to an encoder. |
string | A string. |
encoded_string | The storage for an encoded string. Can be NULL. |
encoded_string_capacity | The capacity of encoded_string including a terminator '\0'. |
const tetengo_text_encoder_t * tetengo_text_encoder_instance | ( | tetengo_text_encoder_encoding_t | encoding | ) |
Returns the encoder instance.
encoding | An encoding. |