WCHARtoUTF8 has a constructor that accepts a wide character pointer "wchar_t *", and an implicit type casting operator to cast to "const char *". Thus it can be used like a function that accepts a wide string as input and returns a UTF8 string as output. Note that the memory required for the output is from the WCHARtoUTF8 object, so it must be used before the object is destroyed.
A typical usage is like:
obj->functionRequiringUTF8(WCHARtoUTF8(a_wchar_t_string));
In the above, the WCHARtoUTF8 object is destroyed after the function returns, so the converted UTF8 string is valid for the lifetime of the function call.
Method | Inherited | Description |
---|---|---|
WCHARtoUTF8 | (Self) | Constructs a WCHARtoUTF8 object. |
const_char_ptr | (Self) | Operator for implicit casting to const char *. |