Pepper_56_C_interfaces
Pepper_56_C_interfaces
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
PPB_CharSet_Trusted_1_0 Struct Reference

#include <ppb_char_set_trusted.h>

Public Attributes

PP_Bool(* UTF16ToCharSet )(const uint16_t utf16[], uint32_t utf16_len, const char *output_char_set, PP_CharSet_Trusted_ConversionError on_error, char *output_buffer, uint32_t *output_length)
 
PP_Bool(* CharSetToUTF16 )(const char *input, uint32_t input_len, const char *input_char_set, PP_CharSet_Trusted_ConversionError on_error, uint16_t *output_buffer, uint32_t *output_utf16_length)
 
struct PP_Var(* GetDefaultCharSet )(PP_Instance instance)
 

Detailed Description

The PPB_CharSet_Trusted interface provides functions for converting between character sets.

This inteface is provided for trusted plugins only since in Native Client it would require an expensive out-of-process IPC call for each conversion, which makes performance unacceptable. Native Client plugins should include ICU or some other library if they need this feature.

Member Data Documentation

PP_Bool(* PPB_CharSet_Trusted_1_0::CharSetToUTF16)(const char *input, uint32_t input_len, const char *input_char_set, PP_CharSet_Trusted_ConversionError on_error, uint16_t *output_buffer, uint32_t *output_utf16_length)

Same as UTF16ToCharSet except converts in the other direction. The input is in the given charset, and the |input_len| is the number of bytes in the |input| string.

Note that the output_utf16_length is measured in UTF-16 characters.

Since UTF16 can represent every Unicode character, the only time the replacement character will be used is if the encoding in the input string is incorrect.

struct PP_Var(* PPB_CharSet_Trusted_1_0::GetDefaultCharSet)(PP_Instance instance)

Returns a string var representing the current multi-byte character set of the current system.

WARNING: You really shouldn't be using this function unless you're dealing with legacy data. You should be using UTF-8 or UTF-16 and you don't have to worry about the character sets.

PP_Bool(* PPB_CharSet_Trusted_1_0::UTF16ToCharSet)(const uint16_t utf16[], uint32_t utf16_len, const char *output_char_set, PP_CharSet_Trusted_ConversionError on_error, char *output_buffer, uint32_t *output_length)

Converts the UTF-16 string pointed to by |*utf16| to an 8-bit string in the specified code page. |utf16_len| is measured in UTF-16 units, not bytes. This value may not be NULL.

The given output buffer will be filled up to output_length bytes with the result. output_length will be updated with the number of bytes required for the given string. The output buffer may be null to just retrieve the required buffer length.

This function will return PP_FALSE if there was an error converting the string and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output character set was unknown. Otherwise, it will return PP_TRUE.


The documentation for this struct was generated from the following file: