[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

gramps gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:45:51 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 22a267d75ae89fc46554aabba263332d5585f4c2
Author: gramps <gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 20 18:17:14 2001 +0000

    Still more QChar implementation
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 0bcf4ef..bc748ec 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -28,21 +28,18 @@
 // FIXME: should QChar and QConstString be in separate source files?
 
 #include <qstring.h>
+#include <ctype.h>
 
-// FIXME: what's the minimum capacity?
-#define SCRATCH_BUFFER_CAPACITY 10
+static UniChar scratchUniChar;
 
-static UniChar scratchBuffer[SCRATCH_BUFFER_CAPACITY];
-
-static CFMutableStringRef GetScratchBufferString()
+static CFMutableStringRef GetScratchUniCharString()
 {
     static CFMutableStringRef s = NULL;
 
     if (!s) {
-        // FIXME: this string object will be leaked once
+        // FIXME: this CFMutableString will be leaked exactly once
         s = CFStringCreateMutableWithExternalCharactersNoCopy(NULL,
-                scratchBuffer, SCRATCH_BUFFER_CAPACITY,
-                SCRATCH_BUFFER_CAPACITY, kCFAllocatorNull);
+                &scratchUniChar, 1, 1, kCFAllocatorNull);
     }
     return s;
 }
@@ -94,56 +91,65 @@ QChar::~QChar()
 
 QChar QChar::lower() const
 {
-    // FIXME: unimplemented
+    scratchUniChar = c;
+    CFStringLowercase(GetScratchUniCharString(), NULL);
+    if (scratchUniChar) {
+	return QChar(scratchUniChar);
+    }
     return *this;
 }
 
 QChar QChar::upper() const
 {
-    // FIXME: unimplemented
+    scratchUniChar = c;
+    CFStringUppercase(GetScratchUniCharString(), NULL);
+    if (scratchUniChar) {
+	return QChar(scratchUniChar);
+    }
     return *this;
 }
 
 char QChar::latin1() const
 {
-    // FIXME: unimplemented
-    return 0;
+    return row() ? 0 : cell();
 }
 
 bool QChar::isNull() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return c == 0;
 }
 
 bool QChar::isDigit() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetDecimalDigit), c);
 }
 
 bool QChar::isSpace() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    if (!row()) {
+	return isspace(c);
+    }
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetWhitespaceAndNewline), c);
 }
 
 bool QChar::isLetter() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetLetter), c);
 }
 
 bool QChar::isLetterOrNumber() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetAlphaNumeric), c) || isDigit();
 }
 
 bool QChar::isPunct() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetPunctuation), c);
 }
 
 uchar QChar::cell() const
@@ -167,7 +173,8 @@ QChar::Direction QChar::direction() const
 bool QChar::mirrored() const
 {
     // FIXME: unimplemented because we don't do BIDI yet
-    // return whether character should be reversed if text direction is reversed
+    // return whether character should be reversed if text direction is
+    // reversed
     return FALSE;
 }
 
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index 0bcf4ef..bc748ec 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -28,21 +28,18 @@
 // FIXME: should QChar and QConstString be in separate source files?
 
 #include <qstring.h>
+#include <ctype.h>
 
-// FIXME: what's the minimum capacity?
-#define SCRATCH_BUFFER_CAPACITY 10
+static UniChar scratchUniChar;
 
-static UniChar scratchBuffer[SCRATCH_BUFFER_CAPACITY];
-
-static CFMutableStringRef GetScratchBufferString()
+static CFMutableStringRef GetScratchUniCharString()
 {
     static CFMutableStringRef s = NULL;
 
     if (!s) {
-        // FIXME: this string object will be leaked once
+        // FIXME: this CFMutableString will be leaked exactly once
         s = CFStringCreateMutableWithExternalCharactersNoCopy(NULL,
-                scratchBuffer, SCRATCH_BUFFER_CAPACITY,
-                SCRATCH_BUFFER_CAPACITY, kCFAllocatorNull);
+                &scratchUniChar, 1, 1, kCFAllocatorNull);
     }
     return s;
 }
@@ -94,56 +91,65 @@ QChar::~QChar()
 
 QChar QChar::lower() const
 {
-    // FIXME: unimplemented
+    scratchUniChar = c;
+    CFStringLowercase(GetScratchUniCharString(), NULL);
+    if (scratchUniChar) {
+	return QChar(scratchUniChar);
+    }
     return *this;
 }
 
 QChar QChar::upper() const
 {
-    // FIXME: unimplemented
+    scratchUniChar = c;
+    CFStringUppercase(GetScratchUniCharString(), NULL);
+    if (scratchUniChar) {
+	return QChar(scratchUniChar);
+    }
     return *this;
 }
 
 char QChar::latin1() const
 {
-    // FIXME: unimplemented
-    return 0;
+    return row() ? 0 : cell();
 }
 
 bool QChar::isNull() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return c == 0;
 }
 
 bool QChar::isDigit() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetDecimalDigit), c);
 }
 
 bool QChar::isSpace() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    if (!row()) {
+	return isspace(c);
+    }
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetWhitespaceAndNewline), c);
 }
 
 bool QChar::isLetter() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetLetter), c);
 }
 
 bool QChar::isLetterOrNumber() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetAlphaNumeric), c) || isDigit();
 }
 
 bool QChar::isPunct() const
 {
-    // FIXME: unimplemented
-    return FALSE;
+    return CFCharacterSetIsCharacterMember(CFCharacterSetGetPredefined(
+                kCFCharacterSetPunctuation), c);
 }
 
 uchar QChar::cell() const
@@ -167,7 +173,8 @@ QChar::Direction QChar::direction() const
 bool QChar::mirrored() const
 {
     // FIXME: unimplemented because we don't do BIDI yet
-    // return whether character should be reversed if text direction is reversed
+    // return whether character should be reversed if text direction is
+    // reversed
     return FALSE;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list