summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/text/qt
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
commit1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch)
tree4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/platform/text/qt
parent9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff)
downloadexternal_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/platform/text/qt')
-rw-r--r--WebCore/platform/text/qt/StringQt.cpp10
-rw-r--r--WebCore/platform/text/qt/TextCodecQt.cpp8
-rw-r--r--WebCore/platform/text/qt/TextCodecQt.h6
3 files changed, 8 insertions, 16 deletions
diff --git a/WebCore/platform/text/qt/StringQt.cpp b/WebCore/platform/text/qt/StringQt.cpp
index 23a684b..de9f527 100644
--- a/WebCore/platform/text/qt/StringQt.cpp
+++ b/WebCore/platform/text/qt/StringQt.cpp
@@ -26,7 +26,6 @@
#include "config.h"
#include "PlatformString.h"
-#include "DeprecatedString.h"
#include <QString>
@@ -44,21 +43,14 @@ String::String(const QStringRef& ref)
{
if (!ref.string())
return;
- m_impl = StringImpl::create(reinterpret_cast<const UChar *>(ref.unicode()), ref.length());
+ m_impl = StringImpl::create(reinterpret_cast<const UChar*>(ref.unicode()), ref.length());
}
-
String::operator QString() const
{
return QString(reinterpret_cast<const QChar*>(characters()), length());
}
-// DeprecatedString conversions
-DeprecatedString::operator QString() const
-{
- return QString(reinterpret_cast<const QChar*>(unicode()), length());
-}
-
}
// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/text/qt/TextCodecQt.cpp b/WebCore/platform/text/qt/TextCodecQt.cpp
index 888c6af..0f385dd 100644
--- a/WebCore/platform/text/qt/TextCodecQt.cpp
+++ b/WebCore/platform/text/qt/TextCodecQt.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006 Lars Knoll <lars@trolltech.com>
+ * Copyright (C) 2008 Holger Hans Peter Freyther
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -91,9 +92,10 @@ TextCodecQt::~TextCodecQt()
}
-String TextCodecQt::decode(const char* bytes, size_t length, bool flush)
+String TextCodecQt::decode(const char* bytes, size_t length, bool flush, bool /*stopOnError*/, bool& sawError)
{
QString unicode = m_codec->toUnicode(bytes, length, &m_state);
+ sawError = m_state.invalidChars != 0;
if (flush) {
m_state.flags = QTextCodec::DefaultConversion;
@@ -104,12 +106,12 @@ String TextCodecQt::decode(const char* bytes, size_t length, bool flush)
return unicode;
}
-CString TextCodecQt::encode(const UChar* characters, size_t length, bool allowEntities)
+CString TextCodecQt::encode(const UChar* characters, size_t length, UnencodableHandling)
{
if (!length)
return "";
- // FIXME: do something sensible with allowEntities
+ // FIXME: do something sensible with UnencodableHandling
QByteArray ba = m_codec->fromUnicode(reinterpret_cast<const QChar*>(characters), length, 0);
return CString(ba.constData(), ba.length());
diff --git a/WebCore/platform/text/qt/TextCodecQt.h b/WebCore/platform/text/qt/TextCodecQt.h
index 9bbb80b..f28f0bb 100644
--- a/WebCore/platform/text/qt/TextCodecQt.h
+++ b/WebCore/platform/text/qt/TextCodecQt.h
@@ -30,8 +30,6 @@
#include "TextEncoding.h"
#include <QTextCodec>
-class QTextCodec;
-
namespace WebCore {
class TextCodecQt : public TextCodec {
@@ -42,8 +40,8 @@ namespace WebCore {
TextCodecQt(const TextEncoding&);
virtual ~TextCodecQt();
- virtual String decode(const char*, size_t length, bool flush = false);
- virtual CString encode(const UChar*, size_t length, bool allowEntities = false);
+ virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError);
+ virtual CString encode(const UChar*, size_t length, UnencodableHandling);
private:
TextEncoding m_encoding;