This class is to pass UTF-8 string directly to String class. More...
#include <cel_string.h>
Public Member Functions | |
utf8s (const UChar1 *str) | |
operator const UChar1 * () const | |
Public Attributes | |
const UChar1 * | m_str |
m_str preserves the pointer to a raw string. More... | |
This class is to pass UTF-8 string directly to String class.
Since String class usually regards char* string as environment specific multibyte string and try to convert it into UTF-8 string, this class is useful when reducing such undesired conversion. In practice, you can use this proxy object to call proper String constructor like the code below:
In the first one, the string is environment specific multibyte string and since String preserves the string in UTF-8, it automatically convert the input string into UTF-8. But what you can see is that every character in the input string is ASCII 7bit character and every one thinks that there are no need to do conversion, and it's true. In the second one, the string is directly duplicated into String instance and there're no conversion, because the input string is regarded as UTF-8 string held in utf8s proxy object. For more information, see String class.
|
inline |
Initializes the instance with UTF-8 string.
str | Specifies the pointer to a raw string. |
|
inline |
This method does conversion into const UChar1 *.
const UChar1* Celartem::utf8s::m_str |
m_str preserves the pointer to a raw string.
Referenced by operator const UChar1 *(), and Celartem::RegularExpression::RegularExpression().