Commit c06c4470 authored by darin's avatar darin

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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bddcc616
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.
......
......@@ -486,6 +486,8 @@
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 */; };
......@@ -2204,6 +2206,8 @@
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>"; };
......@@ -3900,6 +3904,8 @@
93309E9F099EB78C0056E581 /* SharedTimerMac.cpp */,
BC86FB8E061F5C23006BB822 /* SliderMac.mm */,
84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */,
93B0FD880A759BED0080AD44 /* StringImplMac.mm */,
93B0FD890A759BED0080AD44 /* StringMac.mm */,
6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */,
9352071B09BD3BBB00F2038D /* TextBoundaries.mm */,
F587853802DE375901EA4122 /* TextBoxMac.mm */,
......@@ -7286,6 +7292,8 @@
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;
};
......
......@@ -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)
......
/**
* 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];
}
}
/**
* 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);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment