[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:48:24 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 2e73151a16c362f1f1252bddd503fd761ae45cb9
Author: gramps <gramps at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 2 21:50:12 2001 +0000
Massive implementation and reorganization
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index 1c5d08a..9b2a1b6 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -148,7 +148,7 @@ public:
// static member functions -------------------------------------------------
- static QString number(long, int base=10);
+ static QString number(int /* NOTE: base NOT used */ );
static QString fromLatin1(const char *, int len=-1);
#ifdef USING_BORROWED_KURL
static QString fromLocal8Bit(const char *, int len=-1);
@@ -176,28 +176,23 @@ public:
// member functions --------------------------------------------------------
+ uint length() const;
-#ifdef USING_BORROWED_KURL
- QString copy() const;
- ushort toUShort() const;
- QChar at(uint) const;
-#endif
+ const QChar *unicode() const;
+ const char *latin1() const;
+ const char *ascii() const;
+ QCString utf8() const;
+ QCString local8Bit() const;
bool isNull() const;
bool isEmpty() const;
- uint length() const;
- bool startsWith(const QString &) const;
-
- int toInt() const;
- int toInt(bool *, int base=10) const;
- uint toUInt(bool *ok=0, int base=10) const;
- long toLong(bool *ok=0, int base=10) const;
- float toFloat(bool *b=0) const;
- QString &prepend(const QString &);
- QString &append(const char *);
- QString &append(const QString &);
+#ifdef USING_BORROWED_KURL
+ QChar at(uint) const;
+#endif
+ bool startsWith(const QString &) const;
+ int compare(const QString &) const;
int contains(const char *, bool cs=TRUE) const;
int contains(char) const;
@@ -208,41 +203,53 @@ public:
int findRev(char, int index=0, bool cs=TRUE) const;
int findRev(const char *, int index=0, bool cs=TRUE) const;
- QString &remove(uint, uint);
- QString &replace(const QRegExp &, const QString &);
- QString &insert(uint, const QString &);
- QString &insert(uint, QChar);
- QString &insert(uint, char);
- void truncate(uint pos);
- void fill(QChar, int len=-1);
+#ifdef USING_BORROWED_KURL
+ ushort toUShort() const;
+#endif
+ int toInt(bool *ok=NULL, int base=10) const;
+ uint toUInt(bool *ok=NULL /* NOTE: base NOT used */ ) const;
+ long toLong(bool *ok=NULL, int base=10) const;
+ float toFloat(bool *ok=NULL) const;
- QString arg(int a, int fieldwidth=0, int base=10) const;
- QString arg(const QString &, int fieldwidth=0) const;
+ QString arg(const QString &, int padding=0) const;
+ QString arg(int, int padding=0 /* NOTE: base NOT used */ ) const;
QString left(uint) const;
QString right(uint) const;
QString mid(int, int len=0xffffffff) const;
- int compare(const QString &) const;
-
- const char *latin1() const;
- const char *ascii() const;
- const QChar *unicode() const;
- QCString utf8() const;
- QCString local8Bit() const;
- QString &setUnicode(const QChar *, uint);
+#ifdef USING_BORROWED_KURL
+ QString copy() const;
+#endif
- QString &setNum(int, int base=10);
- QString &sprintf(const char *, ...);
QString lower() const;
QString stripWhiteSpace() const;
QString simplifyWhiteSpace() const;
+
+ QString &setUnicode(const QChar *, uint);
+ QString &setNum(int /* NOTE: base NOT used */ );
+ QString &sprintf(const char *, ...);
+
+ QString &prepend(const QString &);
+ QString &append(const char *);
+ QString &append(const QString &);
+
+ QString &remove(uint, uint);
+ QString &replace(const QRegExp &, const QString &);
+ QString &insert(uint, const QString &);
+ QString &insert(uint, QChar);
+ QString &insert(uint, char);
+
+ void truncate(uint pos);
+ void fill(QChar, int len=-1);
+
void compose();
QString visual(int index=0, int len=-1);
// operators ---------------------------------------------------------------
bool operator!() const;
+ operator QChar () const;
operator const char *() const;
QChar operator[](int) const;
QString &operator+(char);
@@ -251,7 +258,6 @@ public:
QString &operator+=(char);
QString &operator+=(QChar);
QString &operator+=(const QString &);
- operator QChar () const;
// data members ------------------------------------------------------------
@@ -271,8 +277,6 @@ public:
// operators associated with QChar and QString =================================
-QString &operator+(const char *, const QString &);
-QString &operator+(QChar, const QString &);
bool operator==(const QString &, QChar);
bool operator==(const QString &, const QString &);
bool operator==(const QString &, const char *);
@@ -282,6 +286,8 @@ bool operator!=(const QString &, const QString &);
bool operator!=(const QString &, const char *);
bool operator!=(const char *, const QString &);
QString operator+(char, const QString &);
+QString operator+(const char *, const QString &);
+QString operator+(QChar, const QString &);
// class QConstString ==========================================================
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 2555821..8e8dfcf 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -27,6 +27,7 @@
// #include <Foundation/Foundation.h>
#include <qstring.h>
+#include <stdio.h>
#ifndef USING_BORROWED_QSTRING
@@ -34,9 +35,31 @@
// constants -------------------------------------------------------------------
-const QChar QChar::null;
const QString QString::null;
+// static member functions -----------------------------------------------------
+
+QString QString::number(int n)
+{
+ QString qs;
+ qs.setNum(n);
+ return qs;
+}
+
+QString QString::fromLatin1(const char *, int)
+{
+ // FIXME: not yet implemented
+ return QString();
+}
+
+#ifdef USING_BORROWED_KURL
+QString QString::fromLocal8Bit(const char *, int)
+{
+ // FIXME: not yet implemented
+ return QString();
+}
+#endif // USING_BORROWED_KURL
+
// constructors, copy constructors, and destructors ----------------------------
QString::QString()
@@ -48,7 +71,7 @@ QString::QString()
QString::QString(QChar qc)
{
- s = CFStringCreateMutable(NULL, 0);
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
if (s) {
CFStringAppendCharacters(s, &qc.c, 1);
}
@@ -59,7 +82,7 @@ QString::QString(QChar qc)
QString::QString(const QByteArray &qba)
{
if (qba.size() && *qba.data()) {
- s = CFStringCreateMutable(NULL, 0);
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
if (s) {
const int capacity = 64;
UniChar buf[capacity];
@@ -86,7 +109,7 @@ QString::QString(const QByteArray &qba)
QString::QString(const QChar *qcs, uint len)
{
if (qcs || len) {
- s = CFStringCreateMutable(NULL, 0);
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
if (s) {
CFStringAppendCharacters(s, &qcs->c, len);
}
@@ -100,7 +123,7 @@ QString::QString(const QChar *qcs, uint len)
QString::QString(const char *chs)
{
if (chs && *chs) {
- s = CFStringCreateMutable(NULL, 0);
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
if (s) {
// FIXME: is ISO Latin-1 the correct encoding?
CFStringAppendCString(s, chs, kCFStringEncodingISOLatin1);
@@ -112,13 +135,13 @@ QString::QString(const char *chs)
cacheType = CacheInvalid;
}
-QString::QString(const QString &other)
+QString::QString(const QString &qs)
{
// shared copy
- if (other.s) {
- CFRetain(other.s);
+ if (qs.s) {
+ CFRetain(qs.s);
}
- s = other.s;
+ s = qs.s;
cache = NULL;
cacheType = CacheInvalid;
}
@@ -129,7 +152,7 @@ QString::~QString()
CFRelease(s);
}
if (cache) {
- CFAllocatorDeallocate(CFAllocatorGetDefault(), cache);
+ CFAllocatorDeallocate(kCFAllocatorDefault, cache);
}
}
@@ -171,29 +194,6 @@ QString &QString::operator=(char ch)
// member functions ------------------------------------------------------------
-#ifdef USING_BORROWED_KURL
-QString QString::copy() const
-{
- // FIXME: not yet implemented
- return *this;
-}
-ushort QString::toUShort() const
-{
- // FIXME: not yet implemented
- return 0;
-}
-QChar QString::at(uint) const
-{
- // FIXME: not yet implemented
- return QChar(0);
-}
-QString QString::fromLocal8Bit(const char *, int)
-{
- // FIXME: not yet implemented
- return QString();
-}
-#endif // USING_BORROWED_KURL
-
uint QString::length() const
{
return s ? CFStringGetLength(s) : 0;
@@ -209,12 +209,12 @@ const QChar *QString::unicode() const
// NSLog(@"CFStringGetCharactersPtr returned NULL!!!");
if (cacheType != CacheUnicode) {
if (cache) {
- CFAllocatorDeallocate(CFAllocatorGetDefault(), cache);
+ CFAllocatorDeallocate(kCFAllocatorDefault, cache);
cache = NULL;
cacheType = CacheInvalid;
}
if (!cache) {
- cache = CFAllocatorAllocate(CFAllocatorGetDefault(),
+ cache = CFAllocatorAllocate(kCFAllocatorDefault,
len * sizeof (UniChar), 0);
}
if (cache) {
@@ -242,13 +242,13 @@ const char *QString::latin1() const
// NSLog(@"CFStringGetCStringPtr returned NULL!!!");
if (cacheType != CacheLatin1) {
if (cache) {
- CFAllocatorDeallocate(CFAllocatorGetDefault(), cache);
+ CFAllocatorDeallocate(kCFAllocatorDefault, cache);
cache = NULL;
cacheType = CacheInvalid;
}
if (!cache) {
- cache = CFAllocatorAllocate(CFAllocatorGetDefault(),
- len + 1, 0);
+ cache = CFAllocatorAllocate(kCFAllocatorDefault, len + 1,
+ 0);
}
if (cache) {
// FIXME: is ISO Latin-1 the correct encoding?
@@ -275,6 +275,18 @@ const char *QString::ascii() const
return latin1();
}
+QCString QString::utf8() const
+{
+ // FIXME: not yet implemented
+ return QCString();
+}
+
+QCString QString::local8Bit() const
+{
+ // FIXME: not yet implemented
+ return QCString();
+}
+
bool QString::isNull() const
{
// NOTE: do NOT use "unicode() == NULL"
@@ -286,236 +298,413 @@ bool QString::isEmpty() const
return length() == 0;
}
-bool QString::startsWith(const QString &) const
+#ifdef USING_BORROWED_KURL
+QChar QString::at(uint) const
{
// FIXME: not yet implemented
- return FALSE;
+ return QChar(0);
}
+#endif // USING_BORROWED_KURL
-int QString::toInt() const
+bool QString::startsWith(const QString &) const
{
// FIXME: not yet implemented
- return 0;
+ return FALSE;
}
-int QString::toInt(bool *, int) const
+int QString::compare(const QString &) const
{
// FIXME: not yet implemented
return 0;
}
-uint QString::toUInt(bool *, int) const
+int QString::contains(const char *, bool) const
{
// FIXME: not yet implemented
return 0;
}
-long QString::toLong(bool *, int) const
+int QString::contains(char) const
{
// FIXME: not yet implemented
return 0;
}
-float QString::toFloat(bool *) const
-{
- // FIXME: not yet implemented
- return 0.0f;
-}
-
-QString &QString::prepend(const QString &)
+int QString::find(char, int, bool) const
{
// FIXME: not yet implemented
- return *this;
+ return 0;
}
-QString &QString::append(const char *)
+int QString::find(QChar, int, bool) const
{
// FIXME: not yet implemented
- return *this;
+ return 0;
}
-QString &QString::append(const QString &)
+int QString::find(const QString &, int, bool) const
{
// FIXME: not yet implemented
- return *this;
+ return 0;
}
-int QString::contains(const char *, bool) const
+int QString::find(const QRegExp &, int, bool) const
{
// FIXME: not yet implemented
return 0;
}
-int QString::contains(char) const
+int QString::findRev(char, int, bool) const
{
// FIXME: not yet implemented
return 0;
}
-int QString::find(char, int, bool) const
+int QString::findRev(const char *, int, bool) const
{
// FIXME: not yet implemented
return 0;
}
-int QString::find(QChar, int, bool) const
+#ifdef USING_BORROWED_KURL
+ushort QString::toUShort() const
{
- // FIXME: not yet implemented
- return 0;
+ return toUInt();
}
+#endif // USING_BORROWED_KURL
-int QString::find(const QString &, int, bool) const
+int QString::toInt(bool *ok, int base) const
{
- // FIXME: not yet implemented
- return 0;
+ return toLong(ok, base);
}
-int QString::find(const QRegExp &, int, bool) const
+uint QString::toUInt(bool *ok) const
{
- // FIXME: not yet implemented
- return 0;
+ uint n = 0;
+ bool valid = FALSE;
+ if (s) {
+ CFIndex len = CFStringGetLength(s);
+ if (len) {
+ CFStringInlineBuffer buf;
+ UniChar uc;
+ CFCharacterSetRef wscs =
+ CFCharacterSetGetPredefined(
+ kCFCharacterSetWhitespaceAndNewline);
+ CFStringInitInlineBuffer(s, &buf, CFRangeMake(0, len));
+ CFIndex i;
+ for (i = 0; i < len; i++) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (!CFCharacterSetIsCharacterMember(wscs, uc)) {
+ break;
+ }
+ }
+ while (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if ((uc >= '0') && (uc <= '9')) {
+ n += uc - '0';
+ } else {
+ break;
+ }
+ valid = TRUE;
+ i++;
+ }
+ while (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (!CFCharacterSetIsCharacterMember(wscs, uc)) {
+ valid = FALSE;
+ break;
+ }
+ i++;
+ }
+ }
+ }
+ if (ok) {
+ *ok = valid;
+ }
+ return valid ? n : 0;
}
-int QString::findRev(char, int, bool) const
+long QString::toLong(bool *ok, int base) const
{
- // FIXME: not yet implemented
- return 0;
+ long n = 0;
+ bool valid = FALSE;
+ if (s) {
+ CFIndex len = CFStringGetLength(s);
+ if (len) {
+ CFStringInlineBuffer buf;
+ UniChar uc;
+ CFCharacterSetRef wscs =
+ CFCharacterSetGetPredefined(
+ kCFCharacterSetWhitespaceAndNewline);
+ CFStringInitInlineBuffer(s, &buf, CFRangeMake(0, len));
+ CFIndex i;
+ for (i = 0; i < len; i++) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (!CFCharacterSetIsCharacterMember(wscs, uc)) {
+ break;
+ }
+ }
+ bool neg = FALSE;
+ if (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (uc == '-') {
+ i++;
+ neg = TRUE;
+ } else if (uc == '+') {
+ i++;
+ }
+ }
+ while (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ // NOTE: ignore anything other than base 10 and base 16
+ if ((uc >= '0') && (uc <= '9')) {
+ n += uc - '0';
+ } else if (base == 16) {
+ if ((uc >= 'A') && (uc <= 'F')) {
+ n += 10 + (uc - 'A');
+ } else if ((uc >= 'a') && (uc <= 'f')) {
+ n += 10 + (uc - 'a');
+ } else {
+ break;
+ }
+ } else {
+ break;
+ }
+ valid = TRUE;
+ i++;
+ }
+ if (neg) {
+ n = -n;
+ }
+ while (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (!CFCharacterSetIsCharacterMember(wscs, uc)) {
+ valid = FALSE;
+ break;
+ }
+ i++;
+ }
+ }
+ }
+ if (ok) {
+ *ok = valid;
+ }
+ return valid ? n : 0;
}
-int QString::findRev(const char *, int, bool) const
+float QString::toFloat(bool *ok) const
{
- // FIXME: not yet implemented
- return 0;
+ float n;
+ if (s) {
+ n = CFStringGetDoubleValue(s);
+ } else {
+ n = 0.0;
+ }
+ if (ok) {
+ // NOTE: since CFStringGetDoubleValue returns 0.0 on error there is no
+ // way to know if "n" is valid in that case
+ if (n == 0.0) {
+ *ok = FALSE;
+ } else {
+ *ok = TRUE;
+ }
+ }
+ return n;
}
-QString &QString::remove(uint, uint)
+QString QString::arg(const QString &replacement, int padding) const
{
- // FIXME: not yet implemented
- return *this;
+ QString modified(*this);
+ if (!modified.s) {
+ modified.s = CFStringCreateMutable(kCFAllocatorDefault, 0);
+ }
+ if (modified.s) {
+ CFIndex pos = 0;
+ CFIndex len = CFStringGetLength(modified.s);
+ if (len) {
+ UniChar found = 0;
+ CFStringInlineBuffer buf;
+ CFStringInitInlineBuffer(modified.s, &buf, CFRangeMake(0, len));
+ for (CFIndex i = 0; i < len; i++) {
+ UniChar uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if ((uc == '%') && ((i + 1) < len)) {
+ UniChar uc2 = CFStringGetCharacterFromInlineBuffer(&buf,
+ i + 1);
+ if ((uc2 >= '0') && (uc2 <= '9')) {
+ if (!found || (uc2 < found)) {
+ found = uc2;
+ pos = i;
+ }
+ }
+ }
+ }
+ }
+ CFIndex rlen;
+ if (pos) {
+ rlen = 2;
+ } else {
+ CFStringAppend(modified.s, CFSTR(" "));
+ pos = len + 1;
+ rlen = 0;
+ }
+ if (replacement.s) {
+ CFStringReplace(modified.s, CFRangeMake(pos, rlen), replacement.s);
+ if (padding) {
+ CFMutableStringRef p =
+ CFStringCreateMutable(kCFAllocatorDefault, 0);
+ if (p) {
+ CFIndex plen;
+ if (padding < 0) {
+ plen = -padding;
+ pos += CFStringGetLength(replacement.s);
+ } else {
+ plen = padding;
+ }
+ CFStringPad(p, CFSTR(" "), plen, 0);
+ CFStringInsert(modified.s, pos, p);
+ CFRelease(p);
+ }
+ }
+ }
+ }
+ return modified;
}
-QString &QString::replace(const QRegExp &, const QString &)
+QString QString::arg(int replacement, int padding) const
{
- // FIXME: not yet implemented
- return *this;
+ return arg(number(replacement), padding);
}
-QString &QString::insert(uint, char)
+QString QString::left(uint) const
{
// FIXME: not yet implemented
- return *this;
+ return QString(*this);
}
-QString &QString::insert(uint, QChar)
+QString QString::right(uint) const
{
// FIXME: not yet implemented
- return *this;
+ return QString(*this);
}
-QString &QString::insert(uint, const QString &)
+QString QString::mid(int, int) const
{
// FIXME: not yet implemented
- return *this;
+ return QString(*this);
}
-void QString::truncate(uint)
+#ifdef USING_BORROWED_KURL
+QString QString::copy() const
{
// FIXME: not yet implemented
+ return QString(*this);
}
+#endif // USING_BORROWED_KURL
-void QString::fill(QChar, int)
+QString QString::lower() const
{
// FIXME: not yet implemented
+ return QString(*this);
}
-QString QString::arg(int, int, int) const
+QString QString::stripWhiteSpace() const
{
// FIXME: not yet implemented
return QString(*this);
}
-QString QString::arg(const QString &, int) const
+QString QString::simplifyWhiteSpace() const
{
// FIXME: not yet implemented
return QString(*this);
}
-QString QString::left(uint) const
+QString &QString::setUnicode(const QChar *, uint)
{
// FIXME: not yet implemented
- return QString(*this);
+ return *this;
}
-QString QString::right(uint) const
+QString &QString::setNum(int n)
{
- // FIXME: not yet implemented
- return QString(*this);
+ cacheType = CacheInvalid;
+ if (!s) {
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
+ }
+ if (s) {
+ const int capacity = 64;
+ char buf[capacity];
+ buf[snprintf(buf, capacity - 1, "%d", n)] = '\0';
+ // NOTE: using private __CFStringMakeConstantString function instead of
+ // creating a temporary string with CFStringCreateWithCString
+ CFStringReplace(s, CFRangeMake(0, CFStringGetLength(s)),
+ __CFStringMakeConstantString(buf));
+ }
+ return *this;
}
-QString QString::mid(int, int) const
+QString &QString::sprintf(const char *, ...)
{
// FIXME: not yet implemented
- return QString(*this);
+ return *this;
}
-int QString::compare(const QString &) const
+QString &QString::prepend(const QString &)
{
// FIXME: not yet implemented
- return 0;
+ return *this;
}
-QString QString::fromLatin1(const char *, int)
+QString &QString::append(const char *)
{
// FIXME: not yet implemented
- return QString();
+ return *this;
}
-QCString QString::utf8() const
+QString &QString::append(const QString &)
{
// FIXME: not yet implemented
- return QCString();
+ return *this;
}
-QCString QString::local8Bit() const
+QString &QString::remove(uint, uint)
{
// FIXME: not yet implemented
- return QCString();
+ return *this;
}
-QString &QString::setUnicode(const QChar *, uint)
+QString &QString::replace(const QRegExp &, const QString &)
{
// FIXME: not yet implemented
return *this;
}
-QString &QString::setNum(int, int)
+QString &QString::insert(uint, char)
{
// FIXME: not yet implemented
return *this;
}
-QString &QString::sprintf(const char *, ...)
+QString &QString::insert(uint, QChar)
{
// FIXME: not yet implemented
return *this;
}
-QString QString::lower() const
+QString &QString::insert(uint, const QString &)
{
// FIXME: not yet implemented
- return QString(*this);
+ return *this;
}
-QString QString::stripWhiteSpace() const
+void QString::truncate(uint)
{
// FIXME: not yet implemented
- return QString(*this);
}
-QString QString::simplifyWhiteSpace() const
+void QString::fill(QChar, int)
{
// FIXME: not yet implemented
- return QString(*this);
}
void QString::compose()
@@ -523,7 +712,7 @@ void QString::compose()
// FIXME: not yet implemented
}
-QString QString::visual(int index=0, int len=-1)
+QString QString::visual(int, int)
{
// FIXME: not yet implemented
return *this;
@@ -536,6 +725,12 @@ bool QString::operator!() const
return isNull();
}
+QString::operator QChar() const
+{
+ // FIXME: not yet implemented
+ return QChar();
+}
+
QString::operator const char *() const
{
return latin1();
@@ -583,27 +778,9 @@ QString &QString::operator+=(const QString &)
return *this;
}
-QString::operator QChar() const
-{
- // FIXME: not yet implemented
- return QChar();
-}
-
// operators associated with QChar and QString =================================
-/*
-QString &operator+(const char *, const QString &)
-{
- // FIXME: not yet implemented
-}
-
-QString &operator+(QChar, const QString &)
-{
- // FIXME: not yet implemented
-}
-*/
-
bool operator==(const QString &, QChar)
{
// FIXME: not yet implemented
@@ -679,6 +856,18 @@ QString operator+(char, const QString &)
return QString();
}
+QString operator+(const char *, const QString &)
+{
+ // FIXME: not yet implemented
+ return QString();
+}
+
+QString operator+(QChar, const QString &)
+{
+ // FIXME: not yet implemented
+ return QString();
+}
+
// class QConstString ==========================================================
@@ -689,8 +878,8 @@ QConstString::QConstString(QChar *qcs, uint len)
if (qcs || len) {
// NOTE: use instead of CFStringCreateWithCharactersNoCopy function to
// guarantee backing store is not copied even though string is mutable
- s = CFStringCreateMutableWithExternalCharactersNoCopy(NULL, &qcs->c,
- len, len, kCFAllocatorNull);
+ s = CFStringCreateMutableWithExternalCharactersNoCopy(
+ kCFAllocatorDefault, &qcs->c, len, len, kCFAllocatorNull);
} else {
s = NULL;
}
diff --git a/WebCore/kwq/qt/qstring.h b/WebCore/kwq/qt/qstring.h
index 1c5d08a..9b2a1b6 100644
--- a/WebCore/kwq/qt/qstring.h
+++ b/WebCore/kwq/qt/qstring.h
@@ -148,7 +148,7 @@ public:
// static member functions -------------------------------------------------
- static QString number(long, int base=10);
+ static QString number(int /* NOTE: base NOT used */ );
static QString fromLatin1(const char *, int len=-1);
#ifdef USING_BORROWED_KURL
static QString fromLocal8Bit(const char *, int len=-1);
@@ -176,28 +176,23 @@ public:
// member functions --------------------------------------------------------
+ uint length() const;
-#ifdef USING_BORROWED_KURL
- QString copy() const;
- ushort toUShort() const;
- QChar at(uint) const;
-#endif
+ const QChar *unicode() const;
+ const char *latin1() const;
+ const char *ascii() const;
+ QCString utf8() const;
+ QCString local8Bit() const;
bool isNull() const;
bool isEmpty() const;
- uint length() const;
- bool startsWith(const QString &) const;
-
- int toInt() const;
- int toInt(bool *, int base=10) const;
- uint toUInt(bool *ok=0, int base=10) const;
- long toLong(bool *ok=0, int base=10) const;
- float toFloat(bool *b=0) const;
- QString &prepend(const QString &);
- QString &append(const char *);
- QString &append(const QString &);
+#ifdef USING_BORROWED_KURL
+ QChar at(uint) const;
+#endif
+ bool startsWith(const QString &) const;
+ int compare(const QString &) const;
int contains(const char *, bool cs=TRUE) const;
int contains(char) const;
@@ -208,41 +203,53 @@ public:
int findRev(char, int index=0, bool cs=TRUE) const;
int findRev(const char *, int index=0, bool cs=TRUE) const;
- QString &remove(uint, uint);
- QString &replace(const QRegExp &, const QString &);
- QString &insert(uint, const QString &);
- QString &insert(uint, QChar);
- QString &insert(uint, char);
- void truncate(uint pos);
- void fill(QChar, int len=-1);
+#ifdef USING_BORROWED_KURL
+ ushort toUShort() const;
+#endif
+ int toInt(bool *ok=NULL, int base=10) const;
+ uint toUInt(bool *ok=NULL /* NOTE: base NOT used */ ) const;
+ long toLong(bool *ok=NULL, int base=10) const;
+ float toFloat(bool *ok=NULL) const;
- QString arg(int a, int fieldwidth=0, int base=10) const;
- QString arg(const QString &, int fieldwidth=0) const;
+ QString arg(const QString &, int padding=0) const;
+ QString arg(int, int padding=0 /* NOTE: base NOT used */ ) const;
QString left(uint) const;
QString right(uint) const;
QString mid(int, int len=0xffffffff) const;
- int compare(const QString &) const;
-
- const char *latin1() const;
- const char *ascii() const;
- const QChar *unicode() const;
- QCString utf8() const;
- QCString local8Bit() const;
- QString &setUnicode(const QChar *, uint);
+#ifdef USING_BORROWED_KURL
+ QString copy() const;
+#endif
- QString &setNum(int, int base=10);
- QString &sprintf(const char *, ...);
QString lower() const;
QString stripWhiteSpace() const;
QString simplifyWhiteSpace() const;
+
+ QString &setUnicode(const QChar *, uint);
+ QString &setNum(int /* NOTE: base NOT used */ );
+ QString &sprintf(const char *, ...);
+
+ QString &prepend(const QString &);
+ QString &append(const char *);
+ QString &append(const QString &);
+
+ QString &remove(uint, uint);
+ QString &replace(const QRegExp &, const QString &);
+ QString &insert(uint, const QString &);
+ QString &insert(uint, QChar);
+ QString &insert(uint, char);
+
+ void truncate(uint pos);
+ void fill(QChar, int len=-1);
+
void compose();
QString visual(int index=0, int len=-1);
// operators ---------------------------------------------------------------
bool operator!() const;
+ operator QChar () const;
operator const char *() const;
QChar operator[](int) const;
QString &operator+(char);
@@ -251,7 +258,6 @@ public:
QString &operator+=(char);
QString &operator+=(QChar);
QString &operator+=(const QString &);
- operator QChar () const;
// data members ------------------------------------------------------------
@@ -271,8 +277,6 @@ public:
// operators associated with QChar and QString =================================
-QString &operator+(const char *, const QString &);
-QString &operator+(QChar, const QString &);
bool operator==(const QString &, QChar);
bool operator==(const QString &, const QString &);
bool operator==(const QString &, const char *);
@@ -282,6 +286,8 @@ bool operator!=(const QString &, const QString &);
bool operator!=(const QString &, const char *);
bool operator!=(const char *, const QString &);
QString operator+(char, const QString &);
+QString operator+(const char *, const QString &);
+QString operator+(QChar, const QString &);
// class QConstString ==========================================================
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index 2555821..8e8dfcf 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -27,6 +27,7 @@
// #include <Foundation/Foundation.h>
#include <qstring.h>
+#include <stdio.h>
#ifndef USING_BORROWED_QSTRING
@@ -34,9 +35,31 @@
// constants -------------------------------------------------------------------
-const QChar QChar::null;
const QString QString::null;
+// static member functions -----------------------------------------------------
+
+QString QString::number(int n)
+{
+ QString qs;
+ qs.setNum(n);
+ return qs;
+}
+
+QString QString::fromLatin1(const char *, int)
+{
+ // FIXME: not yet implemented
+ return QString();
+}
+
+#ifdef USING_BORROWED_KURL
+QString QString::fromLocal8Bit(const char *, int)
+{
+ // FIXME: not yet implemented
+ return QString();
+}
+#endif // USING_BORROWED_KURL
+
// constructors, copy constructors, and destructors ----------------------------
QString::QString()
@@ -48,7 +71,7 @@ QString::QString()
QString::QString(QChar qc)
{
- s = CFStringCreateMutable(NULL, 0);
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
if (s) {
CFStringAppendCharacters(s, &qc.c, 1);
}
@@ -59,7 +82,7 @@ QString::QString(QChar qc)
QString::QString(const QByteArray &qba)
{
if (qba.size() && *qba.data()) {
- s = CFStringCreateMutable(NULL, 0);
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
if (s) {
const int capacity = 64;
UniChar buf[capacity];
@@ -86,7 +109,7 @@ QString::QString(const QByteArray &qba)
QString::QString(const QChar *qcs, uint len)
{
if (qcs || len) {
- s = CFStringCreateMutable(NULL, 0);
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
if (s) {
CFStringAppendCharacters(s, &qcs->c, len);
}
@@ -100,7 +123,7 @@ QString::QString(const QChar *qcs, uint len)
QString::QString(const char *chs)
{
if (chs && *chs) {
- s = CFStringCreateMutable(NULL, 0);
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
if (s) {
// FIXME: is ISO Latin-1 the correct encoding?
CFStringAppendCString(s, chs, kCFStringEncodingISOLatin1);
@@ -112,13 +135,13 @@ QString::QString(const char *chs)
cacheType = CacheInvalid;
}
-QString::QString(const QString &other)
+QString::QString(const QString &qs)
{
// shared copy
- if (other.s) {
- CFRetain(other.s);
+ if (qs.s) {
+ CFRetain(qs.s);
}
- s = other.s;
+ s = qs.s;
cache = NULL;
cacheType = CacheInvalid;
}
@@ -129,7 +152,7 @@ QString::~QString()
CFRelease(s);
}
if (cache) {
- CFAllocatorDeallocate(CFAllocatorGetDefault(), cache);
+ CFAllocatorDeallocate(kCFAllocatorDefault, cache);
}
}
@@ -171,29 +194,6 @@ QString &QString::operator=(char ch)
// member functions ------------------------------------------------------------
-#ifdef USING_BORROWED_KURL
-QString QString::copy() const
-{
- // FIXME: not yet implemented
- return *this;
-}
-ushort QString::toUShort() const
-{
- // FIXME: not yet implemented
- return 0;
-}
-QChar QString::at(uint) const
-{
- // FIXME: not yet implemented
- return QChar(0);
-}
-QString QString::fromLocal8Bit(const char *, int)
-{
- // FIXME: not yet implemented
- return QString();
-}
-#endif // USING_BORROWED_KURL
-
uint QString::length() const
{
return s ? CFStringGetLength(s) : 0;
@@ -209,12 +209,12 @@ const QChar *QString::unicode() const
// NSLog(@"CFStringGetCharactersPtr returned NULL!!!");
if (cacheType != CacheUnicode) {
if (cache) {
- CFAllocatorDeallocate(CFAllocatorGetDefault(), cache);
+ CFAllocatorDeallocate(kCFAllocatorDefault, cache);
cache = NULL;
cacheType = CacheInvalid;
}
if (!cache) {
- cache = CFAllocatorAllocate(CFAllocatorGetDefault(),
+ cache = CFAllocatorAllocate(kCFAllocatorDefault,
len * sizeof (UniChar), 0);
}
if (cache) {
@@ -242,13 +242,13 @@ const char *QString::latin1() const
// NSLog(@"CFStringGetCStringPtr returned NULL!!!");
if (cacheType != CacheLatin1) {
if (cache) {
- CFAllocatorDeallocate(CFAllocatorGetDefault(), cache);
+ CFAllocatorDeallocate(kCFAllocatorDefault, cache);
cache = NULL;
cacheType = CacheInvalid;
}
if (!cache) {
- cache = CFAllocatorAllocate(CFAllocatorGetDefault(),
- len + 1, 0);
+ cache = CFAllocatorAllocate(kCFAllocatorDefault, len + 1,
+ 0);
}
if (cache) {
// FIXME: is ISO Latin-1 the correct encoding?
@@ -275,6 +275,18 @@ const char *QString::ascii() const
return latin1();
}
+QCString QString::utf8() const
+{
+ // FIXME: not yet implemented
+ return QCString();
+}
+
+QCString QString::local8Bit() const
+{
+ // FIXME: not yet implemented
+ return QCString();
+}
+
bool QString::isNull() const
{
// NOTE: do NOT use "unicode() == NULL"
@@ -286,236 +298,413 @@ bool QString::isEmpty() const
return length() == 0;
}
-bool QString::startsWith(const QString &) const
+#ifdef USING_BORROWED_KURL
+QChar QString::at(uint) const
{
// FIXME: not yet implemented
- return FALSE;
+ return QChar(0);
}
+#endif // USING_BORROWED_KURL
-int QString::toInt() const
+bool QString::startsWith(const QString &) const
{
// FIXME: not yet implemented
- return 0;
+ return FALSE;
}
-int QString::toInt(bool *, int) const
+int QString::compare(const QString &) const
{
// FIXME: not yet implemented
return 0;
}
-uint QString::toUInt(bool *, int) const
+int QString::contains(const char *, bool) const
{
// FIXME: not yet implemented
return 0;
}
-long QString::toLong(bool *, int) const
+int QString::contains(char) const
{
// FIXME: not yet implemented
return 0;
}
-float QString::toFloat(bool *) const
-{
- // FIXME: not yet implemented
- return 0.0f;
-}
-
-QString &QString::prepend(const QString &)
+int QString::find(char, int, bool) const
{
// FIXME: not yet implemented
- return *this;
+ return 0;
}
-QString &QString::append(const char *)
+int QString::find(QChar, int, bool) const
{
// FIXME: not yet implemented
- return *this;
+ return 0;
}
-QString &QString::append(const QString &)
+int QString::find(const QString &, int, bool) const
{
// FIXME: not yet implemented
- return *this;
+ return 0;
}
-int QString::contains(const char *, bool) const
+int QString::find(const QRegExp &, int, bool) const
{
// FIXME: not yet implemented
return 0;
}
-int QString::contains(char) const
+int QString::findRev(char, int, bool) const
{
// FIXME: not yet implemented
return 0;
}
-int QString::find(char, int, bool) const
+int QString::findRev(const char *, int, bool) const
{
// FIXME: not yet implemented
return 0;
}
-int QString::find(QChar, int, bool) const
+#ifdef USING_BORROWED_KURL
+ushort QString::toUShort() const
{
- // FIXME: not yet implemented
- return 0;
+ return toUInt();
}
+#endif // USING_BORROWED_KURL
-int QString::find(const QString &, int, bool) const
+int QString::toInt(bool *ok, int base) const
{
- // FIXME: not yet implemented
- return 0;
+ return toLong(ok, base);
}
-int QString::find(const QRegExp &, int, bool) const
+uint QString::toUInt(bool *ok) const
{
- // FIXME: not yet implemented
- return 0;
+ uint n = 0;
+ bool valid = FALSE;
+ if (s) {
+ CFIndex len = CFStringGetLength(s);
+ if (len) {
+ CFStringInlineBuffer buf;
+ UniChar uc;
+ CFCharacterSetRef wscs =
+ CFCharacterSetGetPredefined(
+ kCFCharacterSetWhitespaceAndNewline);
+ CFStringInitInlineBuffer(s, &buf, CFRangeMake(0, len));
+ CFIndex i;
+ for (i = 0; i < len; i++) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (!CFCharacterSetIsCharacterMember(wscs, uc)) {
+ break;
+ }
+ }
+ while (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if ((uc >= '0') && (uc <= '9')) {
+ n += uc - '0';
+ } else {
+ break;
+ }
+ valid = TRUE;
+ i++;
+ }
+ while (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (!CFCharacterSetIsCharacterMember(wscs, uc)) {
+ valid = FALSE;
+ break;
+ }
+ i++;
+ }
+ }
+ }
+ if (ok) {
+ *ok = valid;
+ }
+ return valid ? n : 0;
}
-int QString::findRev(char, int, bool) const
+long QString::toLong(bool *ok, int base) const
{
- // FIXME: not yet implemented
- return 0;
+ long n = 0;
+ bool valid = FALSE;
+ if (s) {
+ CFIndex len = CFStringGetLength(s);
+ if (len) {
+ CFStringInlineBuffer buf;
+ UniChar uc;
+ CFCharacterSetRef wscs =
+ CFCharacterSetGetPredefined(
+ kCFCharacterSetWhitespaceAndNewline);
+ CFStringInitInlineBuffer(s, &buf, CFRangeMake(0, len));
+ CFIndex i;
+ for (i = 0; i < len; i++) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (!CFCharacterSetIsCharacterMember(wscs, uc)) {
+ break;
+ }
+ }
+ bool neg = FALSE;
+ if (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (uc == '-') {
+ i++;
+ neg = TRUE;
+ } else if (uc == '+') {
+ i++;
+ }
+ }
+ while (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ // NOTE: ignore anything other than base 10 and base 16
+ if ((uc >= '0') && (uc <= '9')) {
+ n += uc - '0';
+ } else if (base == 16) {
+ if ((uc >= 'A') && (uc <= 'F')) {
+ n += 10 + (uc - 'A');
+ } else if ((uc >= 'a') && (uc <= 'f')) {
+ n += 10 + (uc - 'a');
+ } else {
+ break;
+ }
+ } else {
+ break;
+ }
+ valid = TRUE;
+ i++;
+ }
+ if (neg) {
+ n = -n;
+ }
+ while (i < len) {
+ uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if (!CFCharacterSetIsCharacterMember(wscs, uc)) {
+ valid = FALSE;
+ break;
+ }
+ i++;
+ }
+ }
+ }
+ if (ok) {
+ *ok = valid;
+ }
+ return valid ? n : 0;
}
-int QString::findRev(const char *, int, bool) const
+float QString::toFloat(bool *ok) const
{
- // FIXME: not yet implemented
- return 0;
+ float n;
+ if (s) {
+ n = CFStringGetDoubleValue(s);
+ } else {
+ n = 0.0;
+ }
+ if (ok) {
+ // NOTE: since CFStringGetDoubleValue returns 0.0 on error there is no
+ // way to know if "n" is valid in that case
+ if (n == 0.0) {
+ *ok = FALSE;
+ } else {
+ *ok = TRUE;
+ }
+ }
+ return n;
}
-QString &QString::remove(uint, uint)
+QString QString::arg(const QString &replacement, int padding) const
{
- // FIXME: not yet implemented
- return *this;
+ QString modified(*this);
+ if (!modified.s) {
+ modified.s = CFStringCreateMutable(kCFAllocatorDefault, 0);
+ }
+ if (modified.s) {
+ CFIndex pos = 0;
+ CFIndex len = CFStringGetLength(modified.s);
+ if (len) {
+ UniChar found = 0;
+ CFStringInlineBuffer buf;
+ CFStringInitInlineBuffer(modified.s, &buf, CFRangeMake(0, len));
+ for (CFIndex i = 0; i < len; i++) {
+ UniChar uc = CFStringGetCharacterFromInlineBuffer(&buf, i);
+ if ((uc == '%') && ((i + 1) < len)) {
+ UniChar uc2 = CFStringGetCharacterFromInlineBuffer(&buf,
+ i + 1);
+ if ((uc2 >= '0') && (uc2 <= '9')) {
+ if (!found || (uc2 < found)) {
+ found = uc2;
+ pos = i;
+ }
+ }
+ }
+ }
+ }
+ CFIndex rlen;
+ if (pos) {
+ rlen = 2;
+ } else {
+ CFStringAppend(modified.s, CFSTR(" "));
+ pos = len + 1;
+ rlen = 0;
+ }
+ if (replacement.s) {
+ CFStringReplace(modified.s, CFRangeMake(pos, rlen), replacement.s);
+ if (padding) {
+ CFMutableStringRef p =
+ CFStringCreateMutable(kCFAllocatorDefault, 0);
+ if (p) {
+ CFIndex plen;
+ if (padding < 0) {
+ plen = -padding;
+ pos += CFStringGetLength(replacement.s);
+ } else {
+ plen = padding;
+ }
+ CFStringPad(p, CFSTR(" "), plen, 0);
+ CFStringInsert(modified.s, pos, p);
+ CFRelease(p);
+ }
+ }
+ }
+ }
+ return modified;
}
-QString &QString::replace(const QRegExp &, const QString &)
+QString QString::arg(int replacement, int padding) const
{
- // FIXME: not yet implemented
- return *this;
+ return arg(number(replacement), padding);
}
-QString &QString::insert(uint, char)
+QString QString::left(uint) const
{
// FIXME: not yet implemented
- return *this;
+ return QString(*this);
}
-QString &QString::insert(uint, QChar)
+QString QString::right(uint) const
{
// FIXME: not yet implemented
- return *this;
+ return QString(*this);
}
-QString &QString::insert(uint, const QString &)
+QString QString::mid(int, int) const
{
// FIXME: not yet implemented
- return *this;
+ return QString(*this);
}
-void QString::truncate(uint)
+#ifdef USING_BORROWED_KURL
+QString QString::copy() const
{
// FIXME: not yet implemented
+ return QString(*this);
}
+#endif // USING_BORROWED_KURL
-void QString::fill(QChar, int)
+QString QString::lower() const
{
// FIXME: not yet implemented
+ return QString(*this);
}
-QString QString::arg(int, int, int) const
+QString QString::stripWhiteSpace() const
{
// FIXME: not yet implemented
return QString(*this);
}
-QString QString::arg(const QString &, int) const
+QString QString::simplifyWhiteSpace() const
{
// FIXME: not yet implemented
return QString(*this);
}
-QString QString::left(uint) const
+QString &QString::setUnicode(const QChar *, uint)
{
// FIXME: not yet implemented
- return QString(*this);
+ return *this;
}
-QString QString::right(uint) const
+QString &QString::setNum(int n)
{
- // FIXME: not yet implemented
- return QString(*this);
+ cacheType = CacheInvalid;
+ if (!s) {
+ s = CFStringCreateMutable(kCFAllocatorDefault, 0);
+ }
+ if (s) {
+ const int capacity = 64;
+ char buf[capacity];
+ buf[snprintf(buf, capacity - 1, "%d", n)] = '\0';
+ // NOTE: using private __CFStringMakeConstantString function instead of
+ // creating a temporary string with CFStringCreateWithCString
+ CFStringReplace(s, CFRangeMake(0, CFStringGetLength(s)),
+ __CFStringMakeConstantString(buf));
+ }
+ return *this;
}
-QString QString::mid(int, int) const
+QString &QString::sprintf(const char *, ...)
{
// FIXME: not yet implemented
- return QString(*this);
+ return *this;
}
-int QString::compare(const QString &) const
+QString &QString::prepend(const QString &)
{
// FIXME: not yet implemented
- return 0;
+ return *this;
}
-QString QString::fromLatin1(const char *, int)
+QString &QString::append(const char *)
{
// FIXME: not yet implemented
- return QString();
+ return *this;
}
-QCString QString::utf8() const
+QString &QString::append(const QString &)
{
// FIXME: not yet implemented
- return QCString();
+ return *this;
}
-QCString QString::local8Bit() const
+QString &QString::remove(uint, uint)
{
// FIXME: not yet implemented
- return QCString();
+ return *this;
}
-QString &QString::setUnicode(const QChar *, uint)
+QString &QString::replace(const QRegExp &, const QString &)
{
// FIXME: not yet implemented
return *this;
}
-QString &QString::setNum(int, int)
+QString &QString::insert(uint, char)
{
// FIXME: not yet implemented
return *this;
}
-QString &QString::sprintf(const char *, ...)
+QString &QString::insert(uint, QChar)
{
// FIXME: not yet implemented
return *this;
}
-QString QString::lower() const
+QString &QString::insert(uint, const QString &)
{
// FIXME: not yet implemented
- return QString(*this);
+ return *this;
}
-QString QString::stripWhiteSpace() const
+void QString::truncate(uint)
{
// FIXME: not yet implemented
- return QString(*this);
}
-QString QString::simplifyWhiteSpace() const
+void QString::fill(QChar, int)
{
// FIXME: not yet implemented
- return QString(*this);
}
void QString::compose()
@@ -523,7 +712,7 @@ void QString::compose()
// FIXME: not yet implemented
}
-QString QString::visual(int index=0, int len=-1)
+QString QString::visual(int, int)
{
// FIXME: not yet implemented
return *this;
@@ -536,6 +725,12 @@ bool QString::operator!() const
return isNull();
}
+QString::operator QChar() const
+{
+ // FIXME: not yet implemented
+ return QChar();
+}
+
QString::operator const char *() const
{
return latin1();
@@ -583,27 +778,9 @@ QString &QString::operator+=(const QString &)
return *this;
}
-QString::operator QChar() const
-{
- // FIXME: not yet implemented
- return QChar();
-}
-
// operators associated with QChar and QString =================================
-/*
-QString &operator+(const char *, const QString &)
-{
- // FIXME: not yet implemented
-}
-
-QString &operator+(QChar, const QString &)
-{
- // FIXME: not yet implemented
-}
-*/
-
bool operator==(const QString &, QChar)
{
// FIXME: not yet implemented
@@ -679,6 +856,18 @@ QString operator+(char, const QString &)
return QString();
}
+QString operator+(const char *, const QString &)
+{
+ // FIXME: not yet implemented
+ return QString();
+}
+
+QString operator+(QChar, const QString &)
+{
+ // FIXME: not yet implemented
+ return QString();
+}
+
// class QConstString ==========================================================
@@ -689,8 +878,8 @@ QConstString::QConstString(QChar *qcs, uint len)
if (qcs || len) {
// NOTE: use instead of CFStringCreateWithCharactersNoCopy function to
// guarantee backing store is not copied even though string is mutable
- s = CFStringCreateMutableWithExternalCharactersNoCopy(NULL, &qcs->c,
- len, len, kCFAllocatorNull);
+ s = CFStringCreateMutableWithExternalCharactersNoCopy(
+ kCFAllocatorDefault, &qcs->c, len, len, kCFAllocatorNull);
} else {
s = NULL;
}
diff --git a/WebCore/src/kwq/qt/qstring.h b/WebCore/src/kwq/qt/qstring.h
index 1c5d08a..9b2a1b6 100644
--- a/WebCore/src/kwq/qt/qstring.h
+++ b/WebCore/src/kwq/qt/qstring.h
@@ -148,7 +148,7 @@ public:
// static member functions -------------------------------------------------
- static QString number(long, int base=10);
+ static QString number(int /* NOTE: base NOT used */ );
static QString fromLatin1(const char *, int len=-1);
#ifdef USING_BORROWED_KURL
static QString fromLocal8Bit(const char *, int len=-1);
@@ -176,28 +176,23 @@ public:
// member functions --------------------------------------------------------
+ uint length() const;
-#ifdef USING_BORROWED_KURL
- QString copy() const;
- ushort toUShort() const;
- QChar at(uint) const;
-#endif
+ const QChar *unicode() const;
+ const char *latin1() const;
+ const char *ascii() const;
+ QCString utf8() const;
+ QCString local8Bit() const;
bool isNull() const;
bool isEmpty() const;
- uint length() const;
- bool startsWith(const QString &) const;
-
- int toInt() const;
- int toInt(bool *, int base=10) const;
- uint toUInt(bool *ok=0, int base=10) const;
- long toLong(bool *ok=0, int base=10) const;
- float toFloat(bool *b=0) const;
- QString &prepend(const QString &);
- QString &append(const char *);
- QString &append(const QString &);
+#ifdef USING_BORROWED_KURL
+ QChar at(uint) const;
+#endif
+ bool startsWith(const QString &) const;
+ int compare(const QString &) const;
int contains(const char *, bool cs=TRUE) const;
int contains(char) const;
@@ -208,41 +203,53 @@ public:
int findRev(char, int index=0, bool cs=TRUE) const;
int findRev(const char *, int index=0, bool cs=TRUE) const;
- QString &remove(uint, uint);
- QString &replace(const QRegExp &, const QString &);
- QString &insert(uint, const QString &);
- QString &insert(uint, QChar);
- QString &insert(uint, char);
- void truncate(uint pos);
- void fill(QChar, int len=-1);
+#ifdef USING_BORROWED_KURL
+ ushort toUShort() const;
+#endif
+ int toInt(bool *ok=NULL, int base=10) const;
+ uint toUInt(bool *ok=NULL /* NOTE: base NOT used */ ) const;
+ long toLong(bool *ok=NULL, int base=10) const;
+ float toFloat(bool *ok=NULL) const;
- QString arg(int a, int fieldwidth=0, int base=10) const;
- QString arg(const QString &, int fieldwidth=0) const;
+ QString arg(const QString &, int padding=0) const;
+ QString arg(int, int padding=0 /* NOTE: base NOT used */ ) const;
QString left(uint) const;
QString right(uint) const;
QString mid(int, int len=0xffffffff) const;
- int compare(const QString &) const;
-
- const char *latin1() const;
- const char *ascii() const;
- const QChar *unicode() const;
- QCString utf8() const;
- QCString local8Bit() const;
- QString &setUnicode(const QChar *, uint);
+#ifdef USING_BORROWED_KURL
+ QString copy() const;
+#endif
- QString &setNum(int, int base=10);
- QString &sprintf(const char *, ...);
QString lower() const;
QString stripWhiteSpace() const;
QString simplifyWhiteSpace() const;
+
+ QString &setUnicode(const QChar *, uint);
+ QString &setNum(int /* NOTE: base NOT used */ );
+ QString &sprintf(const char *, ...);
+
+ QString &prepend(const QString &);
+ QString &append(const char *);
+ QString &append(const QString &);
+
+ QString &remove(uint, uint);
+ QString &replace(const QRegExp &, const QString &);
+ QString &insert(uint, const QString &);
+ QString &insert(uint, QChar);
+ QString &insert(uint, char);
+
+ void truncate(uint pos);
+ void fill(QChar, int len=-1);
+
void compose();
QString visual(int index=0, int len=-1);
// operators ---------------------------------------------------------------
bool operator!() const;
+ operator QChar () const;
operator const char *() const;
QChar operator[](int) const;
QString &operator+(char);
@@ -251,7 +258,6 @@ public:
QString &operator+=(char);
QString &operator+=(QChar);
QString &operator+=(const QString &);
- operator QChar () const;
// data members ------------------------------------------------------------
@@ -271,8 +277,6 @@ public:
// operators associated with QChar and QString =================================
-QString &operator+(const char *, const QString &);
-QString &operator+(QChar, const QString &);
bool operator==(const QString &, QChar);
bool operator==(const QString &, const QString &);
bool operator==(const QString &, const char *);
@@ -282,6 +286,8 @@ bool operator!=(const QString &, const QString &);
bool operator!=(const QString &, const char *);
bool operator!=(const char *, const QString &);
QString operator+(char, const QString &);
+QString operator+(const char *, const QString &);
+QString operator+(QChar, const QString &);
// class QConstString ==========================================================
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list