Public Member Functions | Public Attributes | List of all members
Celartem::utf8s Struct Reference

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 UChar1m_str
 m_str preserves the pointer to a raw string. More...
 

Detailed Description

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:

String str1("This string is regarded as the multibyte string.");
String str2(utf8s("This string is regarded as UTF-8 string."));

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.

See Also
String

Constructor & Destructor Documentation

Celartem::utf8s::utf8s ( const UChar1 str)
inline

Initializes the instance with UTF-8 string.

Parameters
strSpecifies the pointer to a raw string.

Member Function Documentation

Celartem::utf8s::operator const UChar1 * ( ) const
inline

This method does conversion into const UChar1 *.

Member Data Documentation

const UChar1* Celartem::utf8s::m_str

m_str preserves the pointer to a raw string.

Referenced by operator const UChar1 *(), and Celartem::RegularExpression::RegularExpression().


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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo