diff --git a/dictdfiles.cc b/dictdfiles.cc index f1e7868d..2630bb86 100644 --- a/dictdfiles.cc +++ b/dictdfiles.cc @@ -450,8 +450,8 @@ QString const& DictdDictionary::getDescription() if( !dictionaryDescription.isEmpty() ) return dictionaryDescription; - sptr< Dictionary::DataRequest > req = getArticle( GD_NATIVE_TO_WS( L"00databaseinfo" ), - vector< wstring >(), wstring(), false ); + sptr< Dictionary::DataRequest > req = + getArticle( U"00databaseinfo" , vector< wstring >(), wstring(), false ); if( req->dataSize() > 0 ) dictionaryDescription = Html::unescape( QString::fromUtf8( req->getFullData().data(), req->getFullData().size() ), true ); diff --git a/dsl.cc b/dsl.cc index 2dc7425b..b6b845a1 100644 --- a/dsl.cc +++ b/dsl.cc @@ -580,7 +580,7 @@ void DslDictionary::loadArticle( uint32_t address, if ( !articleBody ) { // throw exCantReadFile( getDictionaryFilenames()[ 0 ] ); - articleData = GD_NATIVE_TO_WS( L"\n\r\t" ) + gd::toWString( QString( "DICTZIP error: " ) + dict_error_str( dz ) ); +articleData = U"\n\r\t" + gd::toWString( QString( "DICTZIP error: " ) + dict_error_str( dz ) ); } else { @@ -616,7 +616,7 @@ void DslDictionary::loadArticle( uint32_t address, { size_t begin = pos; - pos = articleData.find_first_of( GD_NATIVE_TO_WS( L"\n\r" ), begin ); + pos = articleData.find_first_of( U"\n\r" , begin ); if ( pos == wstring::npos ) pos = articleData.size(); @@ -741,7 +741,7 @@ void DslDictionary::loadArticle( uint32_t address, if( insidedCard ) { // Check for next insided headword - wstring::size_type hpos = articleData.find_first_of( GD_NATIVE_TO_WS( L"\n\r" ), pos ); + wstring::size_type hpos = articleData.find_first_of( U"\n\r" , pos ); if ( hpos == wstring::npos ) hpos = articleData.size(); @@ -820,13 +820,11 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node ) return result; } - if ( node.tagName == GD_NATIVE_TO_WS( L"b" ) ) + if( node.tagName == U"b" ) result += "" + processNodeChildren( node ) + ""; - else - if ( node.tagName == GD_NATIVE_TO_WS( L"i" ) ) + else if( node.tagName == U"i" ) result += "" + processNodeChildren( node ) + ""; - else - if ( node.tagName == GD_NATIVE_TO_WS( L"u" ) ) + else if( node.tagName == U"u" ) { string nodeText = processNodeChildren( node ); @@ -836,39 +834,32 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node ) result += "" + nodeText + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"c" ) ) + else if( node.tagName == U"c" ) { result += "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"*" ) ) + else if( node.tagName == U"*" ) { string id = "O" + getId().substr( 0, 7 ) + "_" + QString::number( articleNom ).toStdString() + "_opt_" + QString::number( optionalPartNom++ ).toStdString(); result += "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"m" ) ) - result += "
" + processNodeChildren( node ) + "
"; + else if( node.tagName == U"m" ) + result += "
" + processNodeChildren( node ) + "
"; else if ( node.tagName.size() == 2 && node.tagName[ 0 ] == L'm' && iswdigit( node.tagName[ 1 ] ) ) result += "
" + processNodeChildren( node ) + "
"; - else - if ( node.tagName == GD_NATIVE_TO_WS( L"trn" ) ) + else if( node.tagName == U"trn" ) result += "" + processNodeChildren( node ) + ""; - else - if ( node.tagName == GD_NATIVE_TO_WS( L"ex" ) ) + else if( node.tagName == U"ex" ) result += "" + processNodeChildren( node ) + ""; - else - if ( node.tagName == GD_NATIVE_TO_WS( L"com" ) ) + else if( node.tagName == U"com" ) result += "" + processNodeChildren( node ) + ""; - else - if ( node.tagName == GD_NATIVE_TO_WS( L"s" ) || node.tagName == GD_NATIVE_TO_WS( L"video" ) ) + else if( node.tagName == U"s" || node.tagName == U"video" ) { string filename = Filetype::simplifyString( Utf8::encode( node.renderAsText() ), false ); string n = resourceDir1 + FsEncoding::encode( filename ); @@ -1013,8 +1004,7 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node ) + "\">" + processNodeChildren( node ) + ""; } } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"url" ) ) + else if( node.tagName == U"url" ) { string link = Html::escape( Filetype::simplifyString( Utf8::encode( node.renderAsText() ), false ) ); if( QUrl::fromEncoded( link.c_str() ).scheme().isEmpty() ) @@ -1037,13 +1027,11 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node ) result += "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"!trs" ) ) + else if( node.tagName == U"!trs" ) { result += "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"p") ) + else if( node.tagName == U"p" ) { result += ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"'" ) ) + else if( node.tagName == U"'" ) { // There are two ways to display the stress: by adding an accent sign or via font styles. // We generate two spans, one with accented data and another one without it, so the @@ -1101,8 +1088,7 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node ) + "" + data + Utf8::encode( wstring( 1, 0x301 ) ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"lang" ) ) + else if( node.tagName == U"lang" ) { result += ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"ref" ) ) + else if( node.tagName == U"ref" ) { QUrl url; @@ -1158,8 +1143,7 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node ) result += string( "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"@" ) ) + else if( node.tagName == U"@" ) { // Special case - insided card header was not parsed @@ -1174,23 +1158,19 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node ) result += string( "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"sub" ) ) + else if( node.tagName == U"sub" ) { result += "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"sup" ) ) + else if( node.tagName == U"sup" ) { result += "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"t" ) ) + else if( node.tagName == U"t" ) { result += "" + processNodeChildren( node ) + ""; } - else - if ( node.tagName == GD_NATIVE_TO_WS( L"br" ) ) + else if( node.tagName == U"br" ) { result += "
"; } @@ -1377,7 +1357,7 @@ void DslDictionary::getArticleText( uint32_t articleAddress, QString & headword, { size_t begin = pos; - pos = articleData.find_first_of( GD_NATIVE_TO_WS( L"\n\r" ), begin ); + pos = articleData.find_first_of( U"\n\r" , begin ); if ( articleHeadword.empty() ) { @@ -1445,7 +1425,7 @@ void DslDictionary::getArticleText( uint32_t articleAddress, QString & headword, if( insidedCard ) { // Check for next insided headword - wstring::size_type hpos = articleData.find_first_of( GD_NATIVE_TO_WS( L"\n\r" ), pos ); + wstring::size_type hpos = articleData.find_first_of( U"\n\r" , pos ); if ( hpos == wstring::npos ) hpos = articleData.size(); @@ -2075,37 +2055,37 @@ vector< sptr< Dictionary::Class > > makeDictionaries( try { // Here we intercept any errors during the read to save line at // which the incident happened. We need alive scanner for that. - if ( scanner.getDictionaryName() == GD_NATIVE_TO_WS( L"Abbrev" ) ) - continue; // For now just skip abbreviations + if( scanner.getDictionaryName() == U"Abbrev" ) + continue; // For now just skip abbreviations - // Building the index - initializing.indexingDictionary( Utf8::encode( scanner.getDictionaryName() ) ); + // Building the index + initializing.indexingDictionary( Utf8::encode( scanner.getDictionaryName() ) ); - gdDebug( "Dsl: Building the index for dictionary: %s\n", - gd::toQString( scanner.getDictionaryName() ).toUtf8().data() ); + gdDebug( "Dsl: Building the index for dictionary: %s\n", + gd::toQString( scanner.getDictionaryName() ).toUtf8().data() ); - File::Class idx( indexFile, "wb" ); + File::Class idx( indexFile, "wb" ); - IdxHeader idxHeader; + IdxHeader idxHeader; - memset( &idxHeader, 0, sizeof( idxHeader ) ); + memset( &idxHeader, 0, sizeof( idxHeader ) ); - // We write a dummy header first. At the end of the process the header - // will be rewritten with the right values. + // We write a dummy header first. At the end of the process the header + // will be rewritten with the right values. - idx.write( idxHeader ); + idx.write( idxHeader ); - string dictionaryName = Utf8::encode( scanner.getDictionaryName() ); + string dictionaryName = Utf8::encode( scanner.getDictionaryName() ); - idx.write( (uint32_t) dictionaryName.size() ); - idx.write( dictionaryName.data(), dictionaryName.size() ); + idx.write( (uint32_t)dictionaryName.size() ); + idx.write( dictionaryName.data(), dictionaryName.size() ); - string soundDictName = Utf8::encode( scanner.getSoundDictionaryName() ); - if( !soundDictName.empty() ) - { - idxHeader.hasSoundDictionaryName = 1; - idx.write( (uint32_t) soundDictName.size() ); - idx.write( soundDictName.data(), soundDictName.size() ); + string soundDictName = Utf8::encode( scanner.getSoundDictionaryName() ); + if( !soundDictName.empty() ) + { + idxHeader.hasSoundDictionaryName = 1; + idx.write( (uint32_t)soundDictName.size() ); + idx.write( soundDictName.data(), soundDictName.size() ); } idxHeader.dslEncoding = scanner.getEncoding(); @@ -2163,7 +2143,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( if ( eof ) break; - curString.erase( 0, curString.find_first_not_of( GD_NATIVE_TO_WS( L" \t" ) ) ); + curString.erase( 0, curString.find_first_not_of( U" \t" ) ); if ( keys.size() ) expandTildes( curString, keys.front() ); diff --git a/dsl_details.cc b/dsl_details.cc index ec960258..21ee1bbe 100644 --- a/dsl_details.cc +++ b/dsl_details.cc @@ -160,7 +160,7 @@ wstring ArticleDom::Node::renderAsText( bool stripTrsTag ) const wstring result; for( list< Node >::const_iterator i = begin(); i != end(); ++i ) - if( !stripTrsTag || i->tagName != GD_NATIVE_TO_WS( L"!trs" ) ) + if( !stripTrsTag || i->tagName != U"!trs" ) result += i->renderAsText( stripTrsTag ); return result; @@ -169,8 +169,7 @@ wstring ArticleDom::Node::renderAsText( bool stripTrsTag ) const // Returns true if src == 'm' and dest is 'mX', where X is a digit static inline bool checkM( wstring const & dest, wstring const & src ) { - return ( src == GD_NATIVE_TO_WS( L"m" ) && dest.size() == 2 && - dest[ 0 ] == L'm' && iswdigit( dest[ 1 ] ) ); + return ( src == U"m" && dest.size() == 2 && dest[ 0 ] == L'm' && iswdigit( dest[ 1 ] ) ); } ArticleDom::ArticleDom( wstring const & str, string const & dictName, @@ -252,7 +251,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName, wstring linkText = Folding::trimWhitespace( *entry ); ArticleDom nodeDom( linkText, dictName, headword_ ); - Node link( Node::Tag(), GD_NATIVE_TO_WS( L"@" ), wstring() ); + Node link( Node::Tag(), U"@" , wstring() ); for( Node::iterator n = nodeDom.root.begin(); n != nodeDom.root.end(); ++n ) link.push_back( *n ); @@ -262,13 +261,13 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName, { root.push_back( link ); if( entry != allLinkEntries.end() ) // Add line break before next entry - root.push_back( Node( Node::Tag(), GD_NATIVE_TO_WS( L"br" ), wstring() ) ); + root.push_back( Node( Node::Tag(), U"br" , wstring() ) ); } else { stack.back()->push_back( link ); if( entry != allLinkEntries.end() ) - stack.back()->push_back( Node( Node::Tag(), GD_NATIVE_TO_WS( L"br" ), wstring() ) ); + stack.back()->push_back( Node( Node::Tag(), U"br" , wstring() ) ); } } @@ -349,7 +348,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName, } // If the tag is [t], we update the transcriptionCount - if ( name == GD_NATIVE_TO_WS( L"t" ) ) + if( name == U"t" ) { if ( isClosing ) { @@ -361,7 +360,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName, } // If the tag is [s], we update the mediaCount - if ( name == GD_NATIVE_TO_WS( L"s" ) ) + if( name == U"s" ) { if ( isClosing ) { @@ -374,14 +373,13 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName, if ( !isClosing ) { - if ( name == GD_NATIVE_TO_WS( L"m" ) || - ( name.size() == 2 && name[ 0 ] == L'm' && iswdigit( name[ 1 ] ) ) ) + if( name == U"m" || ( name.size() == 2 && name[ 0 ] == L'm' && iswdigit( name[ 1 ] ) ) ) { // Opening an 'mX' or 'm' tag closes any previous 'm' tag - closeTag( GD_NATIVE_TO_WS( L"m" ), stack, false ); + closeTag( U"m" , stack, false ); } openTag( name, attrs, stack ); - if ( name == GD_NATIVE_TO_WS( L"br" ) ) + if( name == U"br" ) { // [br] tag don't have closing tag closeTag( name, stack ); @@ -465,7 +463,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName, processUnsortedParts( linkText, true ); ArticleDom nodeDom( linkText, dictName, headword_ ); - Node link( Node::Tag(), GD_NATIVE_TO_WS( L"ref" ), wstring() ); + Node link( Node::Tag(), U"ref" , wstring() ); for( Node::iterator n = nodeDom.root.begin(); n != nodeDom.root.end(); ++n ) link.push_back( *n ); @@ -640,7 +638,7 @@ void ArticleDom::openTag( wstring const & name, { list< Node > nodesToReopen; - if( name == GD_NATIVE_TO_WS( L"m" ) || checkM( name, GD_NATIVE_TO_WS( L"m" ) ) ) + if( name == U"m" || checkM( name, U"m" ) ) { // All tags above [m] tag will be closed and reopened after // to avoid break this tag by closing some other tag. @@ -734,7 +732,7 @@ void ArticleDom::closeTag( wstring const & name, nodesToReopen.push_back( Node( Node::Tag(), stack.back()->tagName, stack.back()->tagAttrs ) ); - if ( stack.back()->empty() && stack.back()->tagName != GD_NATIVE_TO_WS( L"br" ) ) + if( stack.back()->empty() && stack.back()->tagName != U"br" ) { // Empty nodes except [br] tag are deleted since they're no use @@ -917,19 +915,15 @@ DslScanner::DslScanner( string const & fileName ) : bool isLangTo = false; bool isSoundDict = false; - if ( !str.compare( 0, 5, GD_NATIVE_TO_WS( L"#NAME" ), 5 ) ) + if( !str.compare( 0, 5, U"#NAME" , 5 ) ) isName = true; - else - if ( !str.compare( 0, 15, GD_NATIVE_TO_WS( L"#INDEX_LANGUAGE" ), 15 ) ) + else if( !str.compare( 0, 15, U"#INDEX_LANGUAGE" , 15 ) ) isLangFrom = true; - else - if ( !str.compare( 0, 18, GD_NATIVE_TO_WS( L"#CONTENTS_LANGUAGE" ), 18 ) ) + else if( !str.compare( 0, 18, U"#CONTENTS_LANGUAGE" , 18 ) ) isLangTo = true; - else - if ( !str.compare( 0, 17, GD_NATIVE_TO_WS( L"#SOUND_DICTIONARY" ), 17 ) ) + else if( !str.compare( 0, 17, U"#SOUND_DICTIONARY" , 17 ) ) isSoundDict = true; - else - if ( str.compare( 0, 17, GD_NATIVE_TO_WS( L"#SOURCE_CODE_PAGE" ), 17 ) ) + else if( str.compare( 0, 17, U"#SOURCE_CODE_PAGE" , 17 ) ) continue; // Locate the argument @@ -962,14 +956,11 @@ DslScanner::DslScanner( string const & fileName ) : // We don't need that! GD_FDPRINTF( stderr, "Warning: encoding was specified in a Unicode file, ignoring.\n" ); } - else - if ( !wcscasecmp( arg.c_str(), GD_NATIVE_TO_WS( L"Latin" ) ) ) + else if( !arg.compare( U"Latin" ) ) encoding = Utf8::Windows1252; - else - if ( !wcscasecmp( arg.c_str(), GD_NATIVE_TO_WS( L"Cyrillic" ) ) ) + else if( !arg.compare( U"Cyrillic" ) ) encoding = Utf8::Windows1251; - else - if ( !wcscasecmp( arg.c_str(), GD_NATIVE_TO_WS( L"EasternEuropean" ) ) ) + else if( !arg.compare( U"EasternEuropean" ) ) encoding = Utf8::Windows1250; else { @@ -1041,7 +1032,7 @@ bool DslScanner::readNextLine( wstring & out, size_t & offset, bool only_head_wo #ifdef __WIN32 out=line.toStdU32String(); #else - out=line.toStdWString(); + out=line.toStdU32String(); #endif return true; @@ -1256,8 +1247,8 @@ void expandOptionalParts( wstring & str, list< wstring > * result, } } -static const wstring openBraces( GD_NATIVE_TO_WS( L"{{" ) ); -static const wstring closeBraces( GD_NATIVE_TO_WS( L"}}" ) ); +static const wstring openBraces( U"{{" ); +static const wstring closeBraces( U"}}" ); void stripComments( wstring & str, bool & nextLine ) { @@ -1356,11 +1347,11 @@ namespace quint32 dslLanguageToId( wstring const & name ) { - static wstring newSp( GD_NATIVE_TO_WS( L"newspelling" ) ); - static wstring st( GD_NATIVE_TO_WS( L"standard" ) ); - static wstring ms( GD_NATIVE_TO_WS( L"modernsort" ) ); - static wstring ts( GD_NATIVE_TO_WS( L"traditionalsort" ) ); - static wstring prc( GD_NATIVE_TO_WS( L"prc" ) ); + static wstring newSp( U"newspelling" ); + static wstring st( U"standard" ); + static wstring ms( U"modernsort" ); + static wstring ts( U"traditionalsort" ); + static wstring prc( U"prc" ); // Any of those endings are to be removed diff --git a/gls.cc b/gls.cc index c2546dff..9702d4e1 100644 --- a/gls.cc +++ b/gls.cc @@ -179,13 +179,13 @@ GlsScanner::GlsScanner( string const & fileName ) : wstring str; wstring *currentField = 0; - wstring mark = GD_NATIVE_TO_WS( L"###" ); - wstring titleMark = GD_NATIVE_TO_WS( L"### Glossary title:" ); - wstring authorMark = GD_NATIVE_TO_WS( L"### Author:" ); - wstring descriptionMark = GD_NATIVE_TO_WS( L"### Description:" ); - wstring langFromMark = GD_NATIVE_TO_WS( L"### Source language:" ); - wstring langToMark = GD_NATIVE_TO_WS( L"### Target language:" ); - wstring endOfHeaderMark = GD_NATIVE_TO_WS( L"### Glossary section:" ); + wstring mark = U"###" ; + wstring titleMark = U"### Glossary title:" ; + wstring authorMark = U"### Author:" ; + wstring descriptionMark = U"### Description:" ; + wstring langFromMark = U"### Source language:" ; + wstring langToMark = U"### Target language:" ; + wstring endOfHeaderMark = U"### Glossary section:" ; size_t offset; for( ; ; ) @@ -287,7 +287,7 @@ bool GlsScanner::readNextLine( wstring & out, size_t & offset ) #ifdef __WIN32 out = line.toStdU32String(); #else - out = line.toStdWString(); + out = line.toStdU32String(); #endif return true; diff --git a/goldendict.pro b/goldendict.pro index 177d7c80..9e4c3633 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -413,7 +413,6 @@ SOURCES += folding.cc \ hunspell.cc \ dictdfiles.cc \ audiolink.cc \ - wstring.cc \ wstring_qt.cc \ processwrapper.cc \ hotkeywrapper.cc \ diff --git a/wstring.cc b/wstring.cc deleted file mode 100644 index d823b343..00000000 --- a/wstring.cc +++ /dev/null @@ -1,19 +0,0 @@ -#ifdef __WIN32 - -#include "wstring.hh" -#include "iconv.hh" -#include -#include - -namespace gd -{ - wstring __nativeToWs( wchar_t const * str ) - { - QString qStr=QString::fromWCharArray(str); - return qStr.toStdU32String(); - //return Iconv::toWstring( "WCHAR_T", str, wcslen( str ) * sizeof( wchar_t ) ); - } -} - -#endif - diff --git a/wstring.hh b/wstring.hh index 9741b522..d47d2e6f 100644 --- a/wstring.hh +++ b/wstring.hh @@ -13,12 +13,12 @@ /// all Unicode chars were 2 bytes long. After the Unicode got expanded past /// two-byte representation, the guys at Microsoft had probably decided that /// the least painful way to go is to just switch to UTF-16. Or so's the theory. -/// +/// /// Now, the UTF family is an encoding, made for transit purposes -- is not a /// representation. While it's good for passthrough, it's not directly /// applicable for manipulation on Unicode symbols. It must be decoded first to /// a normal UCS. Think like this: UTF to UCS is something like Base64 to ASCII. -/// +/// /// The distinction between Microsoft platform and all other ones is that while /// the latters are stuck in an 8-bit era and use UTF-8 to pass unicode around /// through its venerable interfaces, the former one is stuck in a 16-bit era, @@ -27,7 +27,7 @@ /// solution is even more ugly than the 8-bit one, because it doesn't have a /// benefit of ASCII compatibility, having a much more useless UCS-2 /// compatibility instead. It's stuck in the middle of nowhere, really. -/// +/// /// The question is, what are we going to do with all this? When we do Unicode /// processing in GoldenDict, we want to use real Unicode characters, not some /// UTF-16 encoded ones. To that end, we have two options under Windows: first, @@ -40,23 +40,14 @@ /// introduce our own gd::wstring and gd::wchar types here. On all systems but /// Windows, they are equivalent to std::wstring and wchar_t. On Windows, they /// are basic_string< unsigned int > and unsigned int. +/// +/// +/// Now we have a better built-in type as char32_t and std::u32string namespace gd { - - #ifdef __WIN32 typedef char32_t wchar; typedef std::u32string wstring; - // GD_NATIVE_TO_WS is used to convert L"" strings to a const pointer to - // wchar. - wstring __nativeToWs( wchar_t const * ); - #define GD_NATIVE_TO_WS( str ) ( gd::__nativeToWs( ( str ) ).c_str() ) - - #else - typedef wchar_t wchar; - typedef std::basic_string wstring; - #define GD_NATIVE_TO_WS( str ) ( str ) - #endif } #endif diff --git a/wstring_qt.cc b/wstring_qt.cc index c7ff8b8d..ba124a93 100644 --- a/wstring_qt.cc +++ b/wstring_qt.cc @@ -3,15 +3,9 @@ namespace gd { - - QString toQString( wstring const & in ) { -#ifdef __WIN32 - return QString::fromUcs4( in.c_str() ); -#else - return QString::fromStdWString(in); -#endif + return QString::fromStdU32String( in ); } wstring toWString( QString const & in )