PPB_Var API. More...
Data Fields List
|void(*||AddRef )(struct PP_Var var)|
|void(*||Release )(struct PP_Var var)|
|struct PP_Var(*||VarFromUtf8 )(const char *data, uint32_t len)|
|const char *(*||VarToUtf8 )(struct PP_Var var, uint32_t *len)|
Data Fields Details
VarFromUtf8() creates a string var from a string.
The string must be encoded in valid UTF-8 and is NOT NULL-terminated, the length must be specified in
len. It is an error if the string is not valid UTF-8.
If the length is 0, the
*data pointer will not be dereferenced and may be
NULL. Note, however if length is 0, the "NULL-ness" will not be preserved, as
VarToUtf8 will never return
NULL on success, even for empty strings.
The resulting object will be a refcounted string object. It will be AddRef'ed for the caller. When the caller is done with it, it should be Released.
On error (basically out of memory to allocate the string, or input that is not valid UTF-8), this function will return a Null var.
[in] data A string [in] len The length of the string.
PP_Varstructure containing a reference counted string object.
VarToUtf8() converts a string-type var to a char* encoded in UTF-8.
This string is NOT NULL-terminated. The length will be placed in
*len. If the string is valid but empty the return value will be non-NULL, but
*len will still be 0.
If the var is not a string, this function will return NULL and
*len will be 0.
The returned buffer will be valid as long as the underlying var is alive. If the instance frees its reference, the string will be freed and the pointer will be to arbitrary memory.
[in] var A PP_Var struct containing a string-type var. [in,out] len A pointer to the length of the string-type var.
- A char* encoded in UTF-8.
The documentation for this struct was generated from the following file: