[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:19 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 914914353d8fe83d07028eb3815d37a14f093506
Author: gramps <gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 20 01:32:44 2001 +0000

    Added partial QChar implementation
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index cf2909a..05a3384 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -76,13 +76,14 @@ public:
     QChar();
     QChar(char);
     QChar(uchar);
-    QChar(const QChar &);
-    QChar(ushort);
     QChar(short);
-    QChar(uint);
+    QChar(ushort);
     QChar(int);
+    QChar(uint);
 
-    ~QChar() {}
+    QChar(const QChar &);
+
+    ~QChar();
 
     // member functions --------------------------------------------------------
 
@@ -143,19 +144,22 @@ public:
 
     QString();
     QString(QChar);
-    QString(const QString &);
     QString(const QByteArray &);
     QString(const QChar *, uint);
     QString(const char *);
 
+    QString(const QString &);
+
+    ~QString();
+
+    // assignment operators ----------------------------------------------------
+
     QString &operator=(QChar);
     QString &operator=(const QString &);
     QString &operator=(const char *);
     QString &operator=(const QCString &);
     QString &operator=(char);
 
-    ~QString();
-
     // member functions --------------------------------------------------------
 
     bool isNull() const;
@@ -204,7 +208,7 @@ public:
     QCString utf8() const;
     QCString local8Bit() const;
     QString &setUnicode(const QChar *, uint);
-    
+
     QString &setNum(int, int base=10);
     QString &sprintf(const char *, ...);
     QString lower() const;
@@ -230,7 +234,7 @@ public:
 
 // NOTE: this is NOT private:
     CFMutableStringRef s;
-    
+
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
     
@@ -285,8 +289,9 @@ public:
 
 private:
 
-// add assignment operator 
-// this private declaration prevents assignment
+    // assignment operators ----------------------------------------------------
+
+    // private declaration prevents assignment
 #ifdef _KWQ_PEDANTIC_
     // NOTE: assignment operator not needed
     // QConstString &operator=(const QConstString &);
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index fe371ad..e01eada 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -23,8 +23,165 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+// FIXME: obviously many functions here can be made inline
+
 #include <qstring.h>
 
+// FIXME: what's the minimum capacity?
+#define SCRATCH_BUFFER_CAPACITY 10
+
+static UniChar scratchBuffer[SCRATCH_BUFFER_CAPACITY];
+
+static CFMutableStringRef GetScratchBufferString()
+{
+    static CFMutableStringRef s = NULL;
+
+    if (!s) {
+        // FIXME: this string object will be leaked once
+        s = CFStringCreateMutableWithExternalCharactersNoCopy(NULL,
+                scratchBuffer, SCRATCH_BUFFER_CAPACITY,
+                SCRATCH_BUFFER_CAPACITY, kCFAllocatorNull);
+    }
+    return s;
+}
+
+QChar::QChar()
+{
+    c = 0;
+}
+
+QChar::QChar(char ch)
+{
+    // FIXME: does this kind of conversion work?
+    c = ch;
+}
+
+QChar::QChar(uchar uch)
+{
+    // FIXME: does this kind of conversion work?
+    c = uch;
+}
+
+QChar::QChar(short n)
+{
+    c = n;
+}
+
+QChar::QChar(ushort n)
+{
+    c = n;
+}
+
+QChar::QChar(uint n)
+{
+    c = n;
+}
+
+QChar::QChar(int n)
+{
+    c = n;
+}
+
+QChar::QChar(const QChar &qc)
+{
+    c = qc.c;
+}
+
+QChar::~QChar()
+{
+    // do nothing
+}
+
+QChar QChar::lower() const
+{
+    // FIXME: unimplented
+    return *this;
+}
+
+QChar QChar::upper() const
+{
+    // FIXME: unimplented
+    return *this;
+}
+
+char QChar::latin1() const
+{
+    // FIXME: unimplented
+    return 0;
+}
+
+bool QChar::isNull() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isDigit() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isSpace() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isLetter() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isLetterOrNumber() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isPunct() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+uchar QChar::cell() const
+{
+    // FIXME: unimplented
+    return 0;
+}
+
+uchar QChar::row() const
+{
+    // FIXME: unimplented
+    return 0;
+}
+
+QChar::Direction QChar::direction() const
+{
+    // FIXME: unimplented
+    return DirL;
+}
+
+bool QChar::mirrored() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+QChar QChar::mirroredChar() const
+{
+    // FIXME: unimplented
+    return *this;
+}
+
+ushort QChar::unicode() const
+{
+    // FIXME: unimplented
+    return 0;
+}
+
 QString::QString()
 {
     s = NULL;
@@ -65,8 +222,10 @@ QString::~QString()
 QConstString::QConstString(QChar *qc, uint len)
 {
     if (qc || len) {
-        // FIXME: do we ever need to worry about deallocating the contents?
-        s = const_cast<CFMutableStringRef>(CFStringCreateWithCharactersNoCopy(NULL, &qc->c, len, kCFAllocatorNull));
+        // NOTE: use instead of CFStringCreateWithCharactersNoCopy function to
+        // guarantee backing store is not copied even though string is mutable
+        s = CFStringCreateMutableWithExternalCharactersNoCopy(NULL, &qc->c,
+                len, len, kCFAllocatorNull);
     } else {
         s = NULL;
     }
diff --git a/WebCore/kwq/qt/qstring.h b/WebCore/kwq/qt/qstring.h
index cf2909a..05a3384 100644
--- a/WebCore/kwq/qt/qstring.h
+++ b/WebCore/kwq/qt/qstring.h
@@ -76,13 +76,14 @@ public:
     QChar();
     QChar(char);
     QChar(uchar);
-    QChar(const QChar &);
-    QChar(ushort);
     QChar(short);
-    QChar(uint);
+    QChar(ushort);
     QChar(int);
+    QChar(uint);
 
-    ~QChar() {}
+    QChar(const QChar &);
+
+    ~QChar();
 
     // member functions --------------------------------------------------------
 
@@ -143,19 +144,22 @@ public:
 
     QString();
     QString(QChar);
-    QString(const QString &);
     QString(const QByteArray &);
     QString(const QChar *, uint);
     QString(const char *);
 
+    QString(const QString &);
+
+    ~QString();
+
+    // assignment operators ----------------------------------------------------
+
     QString &operator=(QChar);
     QString &operator=(const QString &);
     QString &operator=(const char *);
     QString &operator=(const QCString &);
     QString &operator=(char);
 
-    ~QString();
-
     // member functions --------------------------------------------------------
 
     bool isNull() const;
@@ -204,7 +208,7 @@ public:
     QCString utf8() const;
     QCString local8Bit() const;
     QString &setUnicode(const QChar *, uint);
-    
+
     QString &setNum(int, int base=10);
     QString &sprintf(const char *, ...);
     QString lower() const;
@@ -230,7 +234,7 @@ public:
 
 // NOTE: this is NOT private:
     CFMutableStringRef s;
-    
+
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
     
@@ -285,8 +289,9 @@ public:
 
 private:
 
-// add assignment operator 
-// this private declaration prevents assignment
+    // assignment operators ----------------------------------------------------
+
+    // private declaration prevents assignment
 #ifdef _KWQ_PEDANTIC_
     // NOTE: assignment operator not needed
     // QConstString &operator=(const QConstString &);
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index fe371ad..e01eada 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -23,8 +23,165 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+// FIXME: obviously many functions here can be made inline
+
 #include <qstring.h>
 
+// FIXME: what's the minimum capacity?
+#define SCRATCH_BUFFER_CAPACITY 10
+
+static UniChar scratchBuffer[SCRATCH_BUFFER_CAPACITY];
+
+static CFMutableStringRef GetScratchBufferString()
+{
+    static CFMutableStringRef s = NULL;
+
+    if (!s) {
+        // FIXME: this string object will be leaked once
+        s = CFStringCreateMutableWithExternalCharactersNoCopy(NULL,
+                scratchBuffer, SCRATCH_BUFFER_CAPACITY,
+                SCRATCH_BUFFER_CAPACITY, kCFAllocatorNull);
+    }
+    return s;
+}
+
+QChar::QChar()
+{
+    c = 0;
+}
+
+QChar::QChar(char ch)
+{
+    // FIXME: does this kind of conversion work?
+    c = ch;
+}
+
+QChar::QChar(uchar uch)
+{
+    // FIXME: does this kind of conversion work?
+    c = uch;
+}
+
+QChar::QChar(short n)
+{
+    c = n;
+}
+
+QChar::QChar(ushort n)
+{
+    c = n;
+}
+
+QChar::QChar(uint n)
+{
+    c = n;
+}
+
+QChar::QChar(int n)
+{
+    c = n;
+}
+
+QChar::QChar(const QChar &qc)
+{
+    c = qc.c;
+}
+
+QChar::~QChar()
+{
+    // do nothing
+}
+
+QChar QChar::lower() const
+{
+    // FIXME: unimplented
+    return *this;
+}
+
+QChar QChar::upper() const
+{
+    // FIXME: unimplented
+    return *this;
+}
+
+char QChar::latin1() const
+{
+    // FIXME: unimplented
+    return 0;
+}
+
+bool QChar::isNull() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isDigit() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isSpace() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isLetter() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isLetterOrNumber() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+bool QChar::isPunct() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+uchar QChar::cell() const
+{
+    // FIXME: unimplented
+    return 0;
+}
+
+uchar QChar::row() const
+{
+    // FIXME: unimplented
+    return 0;
+}
+
+QChar::Direction QChar::direction() const
+{
+    // FIXME: unimplented
+    return DirL;
+}
+
+bool QChar::mirrored() const
+{
+    // FIXME: unimplented
+    return FALSE;
+}
+
+QChar QChar::mirroredChar() const
+{
+    // FIXME: unimplented
+    return *this;
+}
+
+ushort QChar::unicode() const
+{
+    // FIXME: unimplented
+    return 0;
+}
+
 QString::QString()
 {
     s = NULL;
@@ -65,8 +222,10 @@ QString::~QString()
 QConstString::QConstString(QChar *qc, uint len)
 {
     if (qc || len) {
-        // FIXME: do we ever need to worry about deallocating the contents?
-        s = const_cast<CFMutableStringRef>(CFStringCreateWithCharactersNoCopy(NULL, &qc->c, len, kCFAllocatorNull));
+        // NOTE: use instead of CFStringCreateWithCharactersNoCopy function to
+        // guarantee backing store is not copied even though string is mutable
+        s = CFStringCreateMutableWithExternalCharactersNoCopy(NULL, &qc->c,
+                len, len, kCFAllocatorNull);
     } else {
         s = NULL;
     }
diff --git a/WebCore/src/kwq/qt/qstring.h b/WebCore/src/kwq/qt/qstring.h
index cf2909a..05a3384 100644
--- a/WebCore/src/kwq/qt/qstring.h
+++ b/WebCore/src/kwq/qt/qstring.h
@@ -76,13 +76,14 @@ public:
     QChar();
     QChar(char);
     QChar(uchar);
-    QChar(const QChar &);
-    QChar(ushort);
     QChar(short);
-    QChar(uint);
+    QChar(ushort);
     QChar(int);
+    QChar(uint);
 
-    ~QChar() {}
+    QChar(const QChar &);
+
+    ~QChar();
 
     // member functions --------------------------------------------------------
 
@@ -143,19 +144,22 @@ public:
 
     QString();
     QString(QChar);
-    QString(const QString &);
     QString(const QByteArray &);
     QString(const QChar *, uint);
     QString(const char *);
 
+    QString(const QString &);
+
+    ~QString();
+
+    // assignment operators ----------------------------------------------------
+
     QString &operator=(QChar);
     QString &operator=(const QString &);
     QString &operator=(const char *);
     QString &operator=(const QCString &);
     QString &operator=(char);
 
-    ~QString();
-
     // member functions --------------------------------------------------------
 
     bool isNull() const;
@@ -204,7 +208,7 @@ public:
     QCString utf8() const;
     QCString local8Bit() const;
     QString &setUnicode(const QChar *, uint);
-    
+
     QString &setNum(int, int base=10);
     QString &sprintf(const char *, ...);
     QString lower() const;
@@ -230,7 +234,7 @@ public:
 
 // NOTE: this is NOT private:
     CFMutableStringRef s;
-    
+
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
     
@@ -285,8 +289,9 @@ public:
 
 private:
 
-// add assignment operator 
-// this private declaration prevents assignment
+    // assignment operators ----------------------------------------------------
+
+    // private declaration prevents assignment
 #ifdef _KWQ_PEDANTIC_
     // NOTE: assignment operator not needed
     // QConstString &operator=(const QConstString &);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list