summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h
diff options
context:
space:
mode:
authorJedrzej Nowacki <jedrzej.nowacki@nokia.com>2009-08-18 09:01:33 (GMT)
committerJedrzej Nowacki <jedrzej.nowacki@nokia.com>2009-08-18 09:15:11 (GMT)
commit60ad9486a959ac1beb9b850be18fbb787173cfa0 (patch)
treea9b080f78861ed9d9bcb745d84e320bcc57326a4 /src/3rdparty/webkit/JavaScriptCore/runtime/UString.h
parent4d92ed2203ced87802e3e91e530209619d7d2e71 (diff)
downloadQt-60ad9486a959ac1beb9b850be18fbb787173cfa0.zip
Qt-60ad9486a959ac1beb9b850be18fbb787173cfa0.tar.gz
Qt-60ad9486a959ac1beb9b850be18fbb787173cfa0.tar.bz2
Clean up.
Get rid of conversion functions QScript::qtStringFromJSCUString and QScript::qtStringToJSCUString. Code was moved to cast operators. Reviewed-by: Kent Hansen
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/runtime/UString.h')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/UString.h38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h
index 7edb994..0a53c50 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h
@@ -78,17 +78,6 @@ namespace JSC {
public:
-#if PLATFORM(QT)
-
- QString toQString() const
- {
- // Not sure with method is better, 2nd is shorter
- //UString string
- //QString::fromUtf8(string.toString().UTF8String().c_str())
-
- return QString(reinterpret_cast<const QChar*>(this->data()), this->size());
- }
-#endif
typedef CrossThreadRefCounted<OwnFastMallocPtr<UChar> > SharedUChar;
struct BaseString;
struct Rep : Noncopyable {
@@ -376,6 +365,19 @@ namespace JSC {
return m_rep->reserveCapacity(capacity);
}
+#if PLATFORM(QT)
+ operator QString() const
+ {
+ return QString(reinterpret_cast<const QChar*>(this->data()), this->size());
+ }
+
+ UString(const QString& str)
+ {
+ *this = JSC::UString(reinterpret_cast<const UChar*>(str.constData()), str.length());
+ }
+#endif
+
+
private:
void expandCapacity(int requiredLength);
void expandPreCapacity(int requiredPreCap);
@@ -543,6 +545,20 @@ namespace JSC {
return capacityDelta;
}
+#if PLATFORM(QT)
+
+ inline UString operator+(const char* s1, const UString& s2)
+ {
+ return operator+(UString(s1), s2);
+ }
+
+ inline UString operator+(const UString& s1, const char* s2)
+ {
+ return operator+(s1, UString(s2));
+ }
+
+#endif
+
struct IdentifierRepHash : PtrHash<RefPtr<JSC::UString::Rep> > {
static unsigned hash(const RefPtr<JSC::UString::Rep>& key) { return key->computedHash(); }
static unsigned hash(JSC::UString::Rep* key) { return key->computedHash(); }