QT 字符处理
#ifndefHGL_QT_STRING_INCLUDE#defineHGL_QT_STRING_INCLUDE#ifHGL_OS==HGL_OS_WindowsinlineQStringtoQString(consthgl::UTF16String&ws){returnQString::fromWCharArray(ws.c_str(),ws.Length());}inlineQStringToQString(constwchar_t*str,intsize){returnQString::fromUtf16((ushort*)str,size);}#elsetemplate<intWS>QStringWCharToQString(constwchar_t*,int);template<>inlineQStringWCharToQString<2>(constwchar_t*str,intsize){returnQString::fromUtf16((ushort*)str,size);}template<>inlineQStringWCharToQString<4>(constwchar_t*str,intsize){returnQString::fromUcs4((uint*)str,size);}inlineQStringtoQString(constwchar_t*str,intsize){returnWCharToQString<sizeof(wchar_t)>(str,size);}inlineQStringtoQString(constu16char*str,intsize){returnQString::fromUtf16((ushort*)str,size);}inlineQStringtoQString(constchar32_t*str,intsize){returnQString::fromUcs4((uint*)str,size);}inlineQStringtoQString(consthgl::UTF16String&str){returnQString::fromUtf16((ushort*)str.c_str(),str.Length());}#endif//HGL_OS==HGL_OS_WindowsinlineQStringtoQString(consthgl::UTF8String&str){returnQString::fromUtf8(str.c_str(),str.Length());}//inlineQStringtoQString(consthgl::UTF32String&str)//{//returnQString::fromUcs4((uint*)str.c_str(),str.Length());//}#endif//HGL_QT_STRING_INCLUDE
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。