RLib  5.7
RLib - an opensource, lightweight and multi-platform framework for cpp programming
System::GlobalizeString Class Reference

Public Member Functions

 GlobalizeString (const String &)
 
 GlobalizeString (LPCTSTR lpctstr, intptr_t length)
 
GlobalizeStringoperator= (const String &str)
 set string More...
 
 operator char * () const
 return as gbk string More...
 
 operator wchar_t * () const
 return as unicode string More...
 
const StringtoString () const
 return internal string More...
 
char * toGBK () const
 return as gbk string More...
 
wchar_t * toUnicode () const
 return as unicode string More...
 
char * toUtf8 () const
 return as utf-8 string More...
 
intptr_t sizeofGBK () const
 get the size of gbk string return by toGBK(), in bytes, not null terminator included. More...
 
intptr_t sizeofUnicode () const
 get the size of unicode string return by toUnicode(), in bytes, not null terminator included. More...
 
intptr_t sizeofUtf8 () const
 get the size of utf8 string return by toUtf8(), in bytes, not null terminator included. More...
 
template<typename char_t >
char_t * SuppressFinalize (char_t *pstr) const
 取消对返回的数据进行自动释放 因此, 必须手动调用 String::Collect() 方法来释放内存 More...
 

Static Public Member Functions

static LPSTR ConvertToMultiByte (LPCWSTR, intptr_t length=-1, intptr_t *out_size=nullptr, Text::Encoding to_codepage=Text::ASCIIEncoding)
 转换为多字符格式字符串 必须手动调用 String::Collect() 方法以释放内存 More...
 
static LPWSTR ConvertToWideChar (LPCSTR, intptr_t length=-1, intptr_t *out_size=nullptr, Text::Encoding from_codepage=Text::ASCIIEncoding)
 转换为宽字符格式字符串 必须手动调用 String::Collect() 方法以释放内存 More...
 

Public Attributes

 RLIB_DECLARE_DYNCREATE
 
StringInfo< void > m_data [3]
 
StringInfo< wchar_t > unicode
 
StringInfo< char > gbk
 
StringInfo< char > utf8
 

Protected Member Functions

void release_all ()
 

Protected Attributes

String m_str
 
union {
   StringInfo< void >   m_data [3]
 
   struct {
      StringInfo< wchar_t >   unicode
 
      StringInfo< char >   gbk
 
      StringInfo< char >   utf8
 
   } 
 
}; 
 

Member Function Documentation

LPSTR GlobalizeString::ConvertToMultiByte ( LPCWSTR  pstr,
intptr_t  length = -1,
intptr_t *  out_size = nullptr,
Text::Encoding  to_codepage = Text::ASCIIEncoding 
)
static

转换为多字符格式字符串 必须手动调用 String::Collect() 方法以释放内存

Parameters
out_size不包括 \0 结尾符大小, in bytes
LPWSTR GlobalizeString::ConvertToWideChar ( LPCSTR  pstr,
intptr_t  length = -1,
intptr_t *  out_size = nullptr,
Text::Encoding  from_codepage = Text::ASCIIEncoding 
)
static

转换为宽字符格式字符串 必须手动调用 String::Collect() 方法以释放内存

Parameters
out_size不包括 \0 结尾符大小, in bytes
System::GlobalizeString::operator char * ( ) const
inline

return as gbk string

System::GlobalizeString::operator wchar_t * ( ) const
inline

return as unicode string

GlobalizeString & GlobalizeString::operator= ( const String str)

set string

intptr_t GlobalizeString::sizeofGBK ( ) const

get the size of gbk string return by toGBK(), in bytes, not null terminator included.

intptr_t GlobalizeString::sizeofUnicode ( ) const

get the size of unicode string return by toUnicode(), in bytes, not null terminator included.

intptr_t GlobalizeString::sizeofUtf8 ( ) const

get the size of utf8 string return by toUtf8(), in bytes, not null terminator included.

template<typename char_t >
char_t* System::GlobalizeString::SuppressFinalize ( char_t *  pstr) const
inline

取消对返回的数据进行自动释放 因此, 必须手动调用 String::Collect() 方法来释放内存

char * GlobalizeString::toGBK ( ) const

return as gbk string

const String& System::GlobalizeString::toString ( ) const
inline

return internal string

wchar_t * GlobalizeString::toUnicode ( ) const

return as unicode string

char * GlobalizeString::toUtf8 ( ) const

return as utf-8 string


The documentation for this class was generated from the following files: