From 604f3c9967fcc0770fb011dfc24b32f88947f32c Mon Sep 17 00:00:00 2001 From: ap Date: Mon, 28 Aug 2006 18:40:39 +0000 Subject: [PATCH] 2006-08-28 Nikolas Zimmermann Reviewed and landed by ap. Fixes one chunk of: http://bugzilla.opendarwin.org/show_bug.cgi?id=10604 Offer QString -> DeprecatedString conversion. * platform/DeprecatedString.h: * platform/qt/StringQt.cpp: (WebCore::DeprecatedString::DeprecatedString): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16078 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 11 +++++++++++ WebCore/platform/DeprecatedString.h | 1 + WebCore/platform/qt/StringQt.cpp | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index ad6f70a7a26..c0955e10947 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,14 @@ +2006-08-28 Nikolas Zimmermann + + Reviewed and landed by ap. + + Fixes one chunk of: http://bugzilla.opendarwin.org/show_bug.cgi?id=10604 + Offer QString -> DeprecatedString conversion. + + * platform/DeprecatedString.h: + * platform/qt/StringQt.cpp: + (WebCore::DeprecatedString::DeprecatedString): + 2006-08-28 Nikolas Zimmermann Reviewed by Tim Hatcher. diff --git a/WebCore/platform/DeprecatedString.h b/WebCore/platform/DeprecatedString.h index 345ce82ff84..3211070f2fe 100644 --- a/WebCore/platform/DeprecatedString.h +++ b/WebCore/platform/DeprecatedString.h @@ -253,6 +253,7 @@ public: operator KJS::UString() const; #if PLATFORM(QT) + DeprecatedString(const QString&); operator QString() const; #endif diff --git a/WebCore/platform/qt/StringQt.cpp b/WebCore/platform/qt/StringQt.cpp index 34b43d73842..a9d72f5dbb7 100644 --- a/WebCore/platform/qt/StringQt.cpp +++ b/WebCore/platform/qt/StringQt.cpp @@ -32,6 +32,7 @@ namespace WebCore { +// String conversions String::String(const QString& qstr) { unsigned int len = qstr.length(); @@ -51,6 +52,17 @@ String::operator QString() const return QString(reinterpret_cast(characters()), length()); } +// DeprecatedString conversions +DeprecatedString::DeprecatedString(const QString& qstr) +{ + if (qstr.isNull()) { + (*this) = DeprecatedString::null; + } else { + QByteArray utf8Data = qstr.toUtf8(); + (*this) = DeprecatedString::fromUtf8(utf8Data.data(), utf8Data.length()); + } +} + DeprecatedString::operator QString() const { return QString(reinterpret_cast(unicode()), length()); -- GitLab