Reviewed by Hyatt.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jul 2006 01:11:12 +0000 (01:11 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jul 2006 01:11:12 +0000 (01:11 +0000)
        - implement String::createCFString

        * WebCore.xcodeproj/project.pbxproj: Added StringImplMac.mm and StringMac.mm.

        * bindings/objc/DOMInternal.mm: Moved NSString conversion functions out of here.

        * platform/mac/StringImplMac.mm: Added. Moved NSString conversion members here
        and added the CFStringRef ones.
        * platform/mac/StringMac.mm: Added. Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15614 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/objc/DOMInternal.mm
WebCore/platform/mac/StringImplMac.mm [new file with mode: 0644]
WebCore/platform/mac/StringMac.mm [new file with mode: 0644]

index 845c04f2f94731d5abdeea8419b7cecc3b4265d7..c4a932df3514b2b116b1eb39de9ca2a56603394b 100644 (file)
@@ -1,3 +1,17 @@
+2006-07-24  Darin Adler  <darin@apple.com>
+
+        Reviewed by Hyatt.
+
+        - implement String::createCFString
+
+        * WebCore.xcodeproj/project.pbxproj: Added StringImplMac.mm and StringMac.mm.
+
+        * bindings/objc/DOMInternal.mm: Moved NSString conversion functions out of here.
+
+        * platform/mac/StringImplMac.mm: Added. Moved NSString conversion members here
+        and added the CFStringRef ones.
+        * platform/mac/StringMac.mm: Added. Ditto.
+
 2006-07-24  David Hyatt  <hyatt@apple.com>
 
         Two bug fixes.
index 27fe087ea88bd2e728279d399750fa14ed98ed0d..b95c7b5288f7d662f1330272e32ed044ced7f8c1 100644 (file)
                939885C408B7E3D100E707C4 /* EventNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 939885C208B7E3D100E707C4 /* EventNames.h */; };
                93A1EAA00A5634C9006960A0 /* ImageDocumentMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93A1EA9F0A5634C9006960A0 /* ImageDocumentMac.mm */; };
                93A1EAA80A563508006960A0 /* ImageDocumentMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 93A1EAA70A563508006960A0 /* ImageDocumentMac.h */; };
+               93B0FD8A0A759BED0080AD44 /* StringImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B0FD880A759BED0080AD44 /* StringImplMac.mm */; };
+               93B0FD8B0A759BED0080AD44 /* StringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B0FD890A759BED0080AD44 /* StringMac.mm */; };
                93B70D5B09EB0C7C009D8468 /* JSDOMParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D3F09EB0C7C009D8468 /* JSDOMParser.cpp */; };
                93B70D5C09EB0C7C009D8468 /* JSDOMParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D4009EB0C7C009D8468 /* JSDOMParser.h */; };
                93B70D5D09EB0C7C009D8468 /* JSXMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D4109EB0C7C009D8468 /* JSXMLHttpRequest.cpp */; };
                93A1EAA70A563508006960A0 /* ImageDocumentMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDocumentMac.h; sourceTree = "<group>"; };
                93ABCE5D06E1A42E0085925B /* FormData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormData.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                93ABCE5E06E1A42E0085925B /* FormData.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = FormData.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               93B0FD880A759BED0080AD44 /* StringImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplMac.mm; sourceTree = "<group>"; };
+               93B0FD890A759BED0080AD44 /* StringMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = StringMac.mm; sourceTree = "<group>"; };
                93B641F106E28C5C0055F610 /* FormDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FormDataMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                93B641F206E28C5C0055F610 /* FormDataMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = FormDataMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                93B70D3F09EB0C7C009D8468 /* JSDOMParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMParser.cpp; sourceTree = "<group>"; };
                                93309E9F099EB78C0056E581 /* SharedTimerMac.cpp */,
                                BC86FB8E061F5C23006BB822 /* SliderMac.mm */,
                                84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */,
+                               93B0FD880A759BED0080AD44 /* StringImplMac.mm */,
+                               93B0FD890A759BED0080AD44 /* StringMac.mm */,
                                6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */,
                                9352071B09BD3BBB00F2038D /* TextBoundaries.mm */,
                                F587853802DE375901EA4122 /* TextBoxMac.mm */,
                                E14842FF0A674A31007E4D39 /* StreamingTextDecoderICU.cpp in Sources */,
                                E14843D60A6754A6007E4D39 /* StreamingTextDecoderMac.cpp in Sources */,
                                1CAF34820A6C405200ABE06E /* WebScriptObject.mm in Sources */,
+                               93B0FD8A0A759BED0080AD44 /* StringImplMac.mm in Sources */,
+                               93B0FD8B0A759BED0080AD44 /* StringMac.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 9ebc805e77c8be97907a2a545a45067afdef3565..672b0f9b5151ef20817b01cde54f479ff6110e62 100644 (file)
@@ -105,29 +105,6 @@ void raiseDOMException(ExceptionCode ec)
     [exception raise];
 }
 
-//------------------------------------------------------------------------------------------
-// String/NSString bridging
-
-StringImpl::operator NSString *() const
-{
-    return [NSString stringWithCharacters:m_data length:m_length];
-}
-
-String::String(NSString* str)
-{
-    if (!str)
-        return;
-
-    CFIndex size = CFStringGetLength(reinterpret_cast<CFStringRef>(str));
-    if (size == 0)
-        m_impl = StringImpl::empty();
-    else {
-        Vector<UChar, 1024> buffer(size);
-        CFStringGetCharacters(reinterpret_cast<CFStringRef>(str), CFRangeMake(0, size), buffer.data());
-        m_impl = new StringImpl(buffer.data(), size);
-    }
-}
-
 //------------------------------------------------------------------------------------------
 
 @implementation WebScriptObject (WebScriptObjectInternal)
diff --git a/WebCore/platform/mac/StringImplMac.mm b/WebCore/platform/mac/StringImplMac.mm
new file mode 100644 (file)
index 0000000..412940c
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "StringImpl.h"
+
+namespace WebCore {
+
+CFStringRef StringImpl::createCFString() const
+{
+    return CFStringCreateWithCharacters(NULL, m_data, m_length);
+}
+
+StringImpl::operator NSString *() const
+{
+    return [NSString stringWithCharacters:m_data length:m_length];
+}
+
+}
diff --git a/WebCore/platform/mac/StringMac.mm b/WebCore/platform/mac/StringMac.mm
new file mode 100644 (file)
index 0000000..60d101c
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+String::String(CFStringRef str)
+{
+    if (!str)
+        return;
+
+    CFIndex size = CFStringGetLength(str);
+    if (size == 0)
+        m_impl = StringImpl::empty();
+    else {
+        Vector<UChar, 1024> buffer(size);
+        CFStringGetCharacters(str, CFRangeMake(0, size), buffer.data());
+        m_impl = new StringImpl(buffer.data(), size);
+    }
+}
+
+String::String(NSString* str)
+{
+    if (!str)
+        return;
+
+    CFIndex size = CFStringGetLength(reinterpret_cast<CFStringRef>(str));
+    if (size == 0)
+        m_impl = StringImpl::empty();
+    else {
+        Vector<UChar, 1024> buffer(size);
+        CFStringGetCharacters(reinterpret_cast<CFStringRef>(str), CFRangeMake(0, size), buffer.data());
+        m_impl = new StringImpl(buffer.data(), size);
+    }
+}
+
+}