[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:56:22 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 0277c56afeae4fd5c40104c2fd812c9653e47469
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Feb 27 11:38:23 2002 +0000
Top level:
Stop borrowing QDir and QFile.
* borrowed-classes.txt: Turn off all remaining borrowed classes.
New functionality to set up a standard filesystem in /tmp for testing.
* Tests/libiftest/IFTestDirectory.c: (IFSetUpTestDirectory):
* Tests/libiftest/IFTestDirectory.h:
* Tests/libiftest/Makefile.am:
* Tests/libiftest/testdir.tar.gz:
Add new tests, also alphabetize all the Qt tests.
* Tests/qt/Makefile.am:
* Tests/qt/qdir-test.chk:
* Tests/qt/qdir-test.cpp: (testDir), (main):
* Tests/qt/qfile-test.chk:
* Tests/qt/qfile-test.cpp: (ReadAndPrintMD5), (main):
* Tests/test.list:
WebCore:
Replace QDir and QFile with clean-room implementations. Add glob
support ot QRegExp reimplementation.
* src/kwq/KWQDir.mm: (QDir::KWQDirPrivate::KWQDirPrivate),
(QDir::KWQDirPrivate::~KWQDirPrivate), (QDir::QDir), (QDir::~QDir),
(QDir::absPath), (QDir::absFilePath), (QDir::cdUp), (QDir::exists),
(QDir::entryList), (QDir::operator=), (QDir::swap):
* src/kwq/KWQFile.mm: (QFile::KWQFilePrivate::KWQFilePrivate),
(QFile::KWQFilePrivate::~KWQFilePrivate), (QFile::QFile), (QFile::~QFile),
(QFile::exists), (QFile::open), (QFile::close), (QFile::readBlock),
(QFile::size):
* src/kwq/KWQRegExp.mm: (QRegExp::KWQRegExpPrivate::KWQRegExpPrivate),
(RegExpFromGlob), (QRegExp::KWQRegExpPrivate::compile), (QRegExp::QRegExp):
* src/kwq/KWQStrList.h:
* src/kwq/Makefile.am:
* src/kwq/qt/_qdir.h:
* src/kwq/qt/_qfile.h:
* src/kwq/qt/_qfileinfo.h:
* src/kwq/qt/qdir.h:
* src/kwq/qt/qfile.h:
* src/kwq/qt/qiodevice.h:
* src/kwq/qt/qregexp.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@674 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 12bd970..154ffd3 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,44 @@
+2002-02-27 Maciej Stachowiak <mjs at apple.com>
+
+ Replace QDir and QFile with clean-room implementations. Add glob
+ support ot QRegExp reimplementation.
+
+ * src/kwq/KWQDir.mm: (QDir::KWQDirPrivate::KWQDirPrivate),
+ (QDir::KWQDirPrivate::~KWQDirPrivate), (QDir::QDir), (QDir::~QDir),
+ (QDir::absPath), (QDir::absFilePath), (QDir::cdUp), (QDir::exists),
+ (QDir::entryList), (QDir::operator=), (QDir::swap):
+ * src/kwq/KWQFile.mm: (QFile::KWQFilePrivate::KWQFilePrivate),
+ (QFile::KWQFilePrivate::~KWQFilePrivate), (QFile::QFile), (QFile::~QFile),
+ (QFile::exists), (QFile::open), (QFile::close), (QFile::readBlock),
+ (QFile::size):
+ * src/kwq/KWQRegExp.mm: (QRegExp::KWQRegExpPrivate::KWQRegExpPrivate),
+ (RegExpFromGlob), (QRegExp::KWQRegExpPrivate::compile), (QRegExp::QRegExp):
+ * src/kwq/KWQStrList.h:
+ * src/kwq/Makefile.am:
+ * src/kwq/qt/_qdir.h:
+ * src/kwq/qt/_qfile.h:
+ * src/kwq/qt/_qfileinfo.h:
+ * src/kwq/qt/qdir.h:
+ * src/kwq/qt/qfile.h:
+ * src/kwq/qt/qiodevice.h:
+ * src/kwq/qt/qregexp.h:
+
+2002-02-25 Maciej Stachowiak <mjs at apple.com>
+
+ Fix two significant memory leaks in QList found by our automated
+ leak-checking code.
+
+ * src/kwq/KWQListImpl.mm: (KWQListNode::~KWQListNode),
+ (KWQListImpl::KWQListPrivate::copyList),
+ (KWQListImpl::KWQListPrivate::~KWQListPrivate), (KWQListImpl::sort):
+
+ Fix a tiny bug tweaked by the new regexp code - we need to flush
+ the cache after calling out to QRegExp::match because it might
+ make calls on the string which create a cache. Caught by the
+ regression tests.
+
+ * src/kwq/KWQString.mm: (QString::replace):
+
2002-02-24 Maciej Stachowiak <mjs at apple.com>
Reimplemented QRegExp in terms of POSIX regexp facilities. This
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 12bd970..154ffd3 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,44 @@
+2002-02-27 Maciej Stachowiak <mjs at apple.com>
+
+ Replace QDir and QFile with clean-room implementations. Add glob
+ support ot QRegExp reimplementation.
+
+ * src/kwq/KWQDir.mm: (QDir::KWQDirPrivate::KWQDirPrivate),
+ (QDir::KWQDirPrivate::~KWQDirPrivate), (QDir::QDir), (QDir::~QDir),
+ (QDir::absPath), (QDir::absFilePath), (QDir::cdUp), (QDir::exists),
+ (QDir::entryList), (QDir::operator=), (QDir::swap):
+ * src/kwq/KWQFile.mm: (QFile::KWQFilePrivate::KWQFilePrivate),
+ (QFile::KWQFilePrivate::~KWQFilePrivate), (QFile::QFile), (QFile::~QFile),
+ (QFile::exists), (QFile::open), (QFile::close), (QFile::readBlock),
+ (QFile::size):
+ * src/kwq/KWQRegExp.mm: (QRegExp::KWQRegExpPrivate::KWQRegExpPrivate),
+ (RegExpFromGlob), (QRegExp::KWQRegExpPrivate::compile), (QRegExp::QRegExp):
+ * src/kwq/KWQStrList.h:
+ * src/kwq/Makefile.am:
+ * src/kwq/qt/_qdir.h:
+ * src/kwq/qt/_qfile.h:
+ * src/kwq/qt/_qfileinfo.h:
+ * src/kwq/qt/qdir.h:
+ * src/kwq/qt/qfile.h:
+ * src/kwq/qt/qiodevice.h:
+ * src/kwq/qt/qregexp.h:
+
+2002-02-25 Maciej Stachowiak <mjs at apple.com>
+
+ Fix two significant memory leaks in QList found by our automated
+ leak-checking code.
+
+ * src/kwq/KWQListImpl.mm: (KWQListNode::~KWQListNode),
+ (KWQListImpl::KWQListPrivate::copyList),
+ (KWQListImpl::KWQListPrivate::~KWQListPrivate), (KWQListImpl::sort):
+
+ Fix a tiny bug tweaked by the new regexp code - we need to flush
+ the cache after calling out to QRegExp::match because it might
+ make calls on the string which create a cache. Caught by the
+ regression tests.
+
+ * src/kwq/KWQString.mm: (QString::replace):
+
2002-02-24 Maciej Stachowiak <mjs at apple.com>
Reimplemented QRegExp in terms of POSIX regexp facilities. This
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 12bd970..154ffd3 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,44 @@
+2002-02-27 Maciej Stachowiak <mjs at apple.com>
+
+ Replace QDir and QFile with clean-room implementations. Add glob
+ support ot QRegExp reimplementation.
+
+ * src/kwq/KWQDir.mm: (QDir::KWQDirPrivate::KWQDirPrivate),
+ (QDir::KWQDirPrivate::~KWQDirPrivate), (QDir::QDir), (QDir::~QDir),
+ (QDir::absPath), (QDir::absFilePath), (QDir::cdUp), (QDir::exists),
+ (QDir::entryList), (QDir::operator=), (QDir::swap):
+ * src/kwq/KWQFile.mm: (QFile::KWQFilePrivate::KWQFilePrivate),
+ (QFile::KWQFilePrivate::~KWQFilePrivate), (QFile::QFile), (QFile::~QFile),
+ (QFile::exists), (QFile::open), (QFile::close), (QFile::readBlock),
+ (QFile::size):
+ * src/kwq/KWQRegExp.mm: (QRegExp::KWQRegExpPrivate::KWQRegExpPrivate),
+ (RegExpFromGlob), (QRegExp::KWQRegExpPrivate::compile), (QRegExp::QRegExp):
+ * src/kwq/KWQStrList.h:
+ * src/kwq/Makefile.am:
+ * src/kwq/qt/_qdir.h:
+ * src/kwq/qt/_qfile.h:
+ * src/kwq/qt/_qfileinfo.h:
+ * src/kwq/qt/qdir.h:
+ * src/kwq/qt/qfile.h:
+ * src/kwq/qt/qiodevice.h:
+ * src/kwq/qt/qregexp.h:
+
+2002-02-25 Maciej Stachowiak <mjs at apple.com>
+
+ Fix two significant memory leaks in QList found by our automated
+ leak-checking code.
+
+ * src/kwq/KWQListImpl.mm: (KWQListNode::~KWQListNode),
+ (KWQListImpl::KWQListPrivate::copyList),
+ (KWQListImpl::KWQListPrivate::~KWQListPrivate), (KWQListImpl::sort):
+
+ Fix a tiny bug tweaked by the new regexp code - we need to flush
+ the cache after calling out to QRegExp::match because it might
+ make calls on the string which create a cache. Caught by the
+ regression tests.
+
+ * src/kwq/KWQString.mm: (QString::replace):
+
2002-02-24 Maciej Stachowiak <mjs at apple.com>
Reimplemented QRegExp in terms of POSIX regexp facilities. This
diff --git a/WebCore/kwq/KWQDir.mm b/WebCore/kwq/KWQDir.mm
new file mode 100644
index 0000000..724ef07
--- /dev/null
+++ b/WebCore/kwq/KWQDir.mm
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <qdir.h>
+
+#ifndef USING_BORROWED_QDIR
+
+#include <kwqdebug.h>
+#import <Foundation/Foundation.h>
+
+#include <qfile.h>
+#include <qstring.h>
+#include <qregexp.h>
+#include <sys/param.h>
+#include <unistd.h>
+
+class QDir::KWQDirPrivate
+{
+public:
+ KWQDirPrivate(const QString &n);
+ KWQDirPrivate(const KWQDirPrivate &other);
+ ~KWQDirPrivate();
+
+ QString name;
+};
+
+QDir::KWQDirPrivate::KWQDirPrivate(const QString &n) : name(n)
+{
+}
+
+QDir::KWQDirPrivate::KWQDirPrivate(const KWQDirPrivate &other) : name(other.name)
+{
+}
+
+QDir::KWQDirPrivate::~KWQDirPrivate()
+{
+}
+
+
+
+QDir::QDir() : d(new QDir::KWQDirPrivate(QString(".")))
+{
+}
+
+QDir::QDir(const QString &name) : d(new QDir::KWQDirPrivate(name))
+{
+}
+
+QDir::QDir(const QDir &other) : d(new QDir::KWQDirPrivate(*other.d))
+{
+}
+
+QDir::~QDir()
+{
+ delete d;
+}
+
+QString QDir::absPath() const
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ QString path;
+ if (d->name[0] == '/') {
+ path = d->name;
+ } else {
+ QString cwdString = QString::fromCFString((CFStringRef)[[NSFileManager defaultManager] currentDirectoryPath]);
+
+ if (cwdString[cwdString.length()-1] != '/') {
+ cwdString += '/';
+ }
+
+ path = cwdString + d->name;
+ }
+
+ // Resolve . and ..
+ path.replace(QRegExp("/./"), "/");
+ path.replace(QRegExp("/[^/]*/../"), "/");
+ path.replace(QRegExp("/[^/]*/..$"), "");
+
+ [pool release];
+ return path;
+}
+
+QString QDir::absFilePath(const QString &fileName) const
+{
+ QString dirPath = absPath();
+
+ if (dirPath[dirPath.length()-1] != '/') {
+ dirPath = dirPath + "/";
+ }
+
+ return dirPath + fileName;
+}
+
+bool QDir::cdUp()
+{
+ QString dirPath = absPath();
+
+ if (dirPath[dirPath.length()-1] != '/') {
+ dirPath += "/";
+ }
+
+ dirPath += "..";
+
+ dirPath.replace(QRegExp("/[^/]*/..$"), "");
+
+ if (QFile::exists(dirPath)) {
+ d->name = dirPath;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool QDir::exists(const QString &fileName) const
+{
+ return QFile::exists(absFilePath(fileName));
+}
+
+QStringList QDir::entryList(const QString &nameFilter)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ QStringList results;
+ {
+ QRegExp filter(nameFilter, TRUE, TRUE);
+
+ NSArray *contents = [[NSFileManager defaultManager] directoryContentsAtPath:(NSString *)(absPath().getCFMutableString())];
+
+ contents = [contents arrayByAddingObjectsFromArray:[NSArray arrayWithObjects:@".", @"..", nil]];
+ contents = [contents sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
+
+ unsigned length = [contents count];
+
+ for (unsigned i = 0; i < length; i++) {
+ QString item = QString::fromCFString((CFStringRef)[contents objectAtIndex:i]);
+
+ if (item.find(filter) != -1 && QFile::exists(absFilePath(item))) {
+ results.append(item);
+ }
+ }
+ }
+
+ [pool release];
+ return results;
+}
+
+QDir &QDir::operator=(const QDir &other)
+{
+ QDir tmp(other);
+
+ swap (tmp);
+
+ return *this;
+}
+
+void QDir::swap(QDir &other)
+{
+ QDir::KWQDirPrivate *tmp;
+
+ tmp = other.d;
+ other.d = d;
+ d = tmp;
+}
+
+#endif
+
diff --git a/WebCore/kwq/KWQFile.h b/WebCore/kwq/KWQFile.h
index 7034859..30fc90e 100644
--- a/WebCore/kwq/KWQFile.h
+++ b/WebCore/kwq/KWQFile.h
@@ -36,178 +36,27 @@
#ifdef USING_BORROWED_QFILE
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <limits.h>
-
-#if !defined(PATH_MAX)
-#if defined(MAXPATHLEN)
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
+#include <_qfile.h>
-#undef STATBUF
-#undef STAT
-#undef STAT_REG
-#undef STAT_DIR
-#undef STAT_LNK
-#undef STAT_MASK
-#undef FILENO
-#undef OPEN
-#undef CLOSE
-#undef LSEEK
-#undef READ
-#undef WRITE
-#undef ACCESS
-#undef GETCWD
-#undef CHDIR
-#undef MKDIR
-#undef RMDIR
-#undef OPEN_RDONLY
-#undef OPEN_WRONLY
-#undef OPEN_CREAT
-#undef OPEN_TRUNC
-#undef OPEN_APPEND
-#undef OPEN_TEXT
-#undef OPEN_BINARY
-
-#define STATBUF struct stat
-#define STATBUF4TSTAT struct stat
-#define STAT ::stat
-#define FSTAT ::fstat
-#define STAT_REG S_IFREG
-#define STAT_DIR S_IFDIR
-#define STAT_MASK S_IFMT
-#if defined(S_IFLNK)
-# define STAT_LNK S_IFLNK
-#endif
-#define FILENO fileno
-#define OPEN ::open
-#define CLOSE ::close
-#define LSEEK ::lseek
-#define READ ::read
-#define WRITE ::write
-#define ACCESS ::access
-#define GETCWD ::getcwd
-#define CHDIR ::chdir
-#define MKDIR ::mkdir
-#define RMDIR ::rmdir
-#define OPEN_RDONLY O_RDONLY
-#define OPEN_WRONLY O_WRONLY
-#define OPEN_RDWR O_RDWR
-#define OPEN_CREAT O_CREAT
-#define OPEN_TRUNC O_TRUNC
-#define OPEN_APPEND O_APPEND
-#if defined(O_TEXT)
-# define OPEN_TEXT O_TEXT
-# define OPEN_BINARY O_BINARY
-#endif
+#else // !USING_BORROWED_QFILE
-#define F_OK 0
+#include <qstring.h>
+#include <qiodevice.h>
-struct QFileInfoCache
+class QFile
{
- STATBUF st;
- bool isSymLink;
-};
-
-
-#endif // USING_BORROWED_QFILE
-
-
-#include "_qiodevice.h"
-#include "qstring.h"
-#include "qcstring.h"
-
-
-// class QFile =================================================================
-
-class QFile : public QIODevice {
public:
-
- // typedefs ----------------------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
- typedef QCString(*EncoderFn)(const QString &);
- typedef QString(*DecoderFn)(const QCString &);
-#endif
-
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
- static QCString encodeName(const QString &);
- static QString decodeName(const QCString &);
- static void setEncodingFunction(EncoderFn);
- static void setDecodingFunction(DecoderFn);
- static bool exists(const QString &);
- static bool remove(const QString &fileName);
-#endif
-
- // constructors, copy constructors, and destructors ------------------------
-
QFile();
QFile(const QString &);
~QFile();
- // member functions --------------------------------------------------------
-
bool exists() const;
bool open(int);
void close();
int readBlock(char *, uint);
uint size() const;
-
-#ifdef USING_BORROWED_QFILE
- bool remove();
-
- QString name() const;
- void setName(const QString &);
-
- bool open(int, FILE *);
- bool open(int, int);
- void flush();
-
- int at() const;
- bool at(int);
- bool atEnd() const;
-
- int writeBlock(const char *, uint);
- int writeBlock(const QByteArray &);
- int readLine(char *, uint);
- int readLine(QString &, uint);
-
- int getch();
- int putch(int);
- int ungetch(int);
-
- int handle() const;
-#endif
-
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
-protected:
- QString fn;
- FILE *fh;
- int fd;
- int length;
- bool ext_f;
- void *d;
-#endif
-
-
-// private ---------------------------------------------------------------------
+ static bool exists(const QString &path);
private:
// no copying or assignment
@@ -215,24 +64,12 @@ private:
QFile(const QFile &);
QFile &operator=(const QFile &);
-#ifdef USING_BORROWED_QFILE
- void init();
- QCString ungetchBuffer;
-#endif
-
-}; // class QFile ==============================================================
+ class KWQFilePrivate;
-#ifdef USING_BORROWED_QFILE
-
-inline int QFile::at() const
-{
- return ioIndex;
-}
-
-inline QString QFile::name() const
-{ return fn; }
+ KWQFilePrivate *d;
+};
#endif // USING_BORROWED_QFILE
-#endif
+#endif // QFILE_H_
diff --git a/WebCore/kwq/KWQPalette.mm b/WebCore/kwq/KWQFile.mm
similarity index 50%
copy from WebCore/kwq/KWQPalette.mm
copy to WebCore/kwq/KWQFile.mm
index 6dfe312..3d33669 100644
--- a/WebCore/kwq/KWQPalette.mm
+++ b/WebCore/kwq/KWQFile.mm
@@ -23,94 +23,108 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <qpalette.h>
+#include <qfile.h>
+#ifndef USING_BORROWED_QFILE
-class QPalettePrivate
+#include <kwqdebug.h>
+#import <Foundation/Foundation.h>
+#include <sys/param.h>
+#include <qstring.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <qiodevice.h>
+
+class QFile::KWQFilePrivate
{
-friend class QPalette;
public:
- QPalettePrivate() : active(), inactive(), disabled()
- {
- }
+ KWQFilePrivate(const QString &name);
+ ~KWQFilePrivate();
- QPalettePrivate(const QPalettePrivate *other) :
- active(other->active),
- inactive(other->inactive),
- disabled(other->disabled)
- {
- }
-
-private:
- QColorGroup active;
- QColorGroup inactive;
- QColorGroup disabled;
+ char *name;
+ int fd;
};
-#include <kwqdebug.h>
-QPalette::QPalette()
+QFile::KWQFilePrivate::KWQFilePrivate(const QString &qname) : name(malloc(sizeof(char) * MAXPATHLEN)), fd(-1)
{
- d = new QPalettePrivate();
+ NSString *nsname = (NSString *)qname.getCFMutableString();
+
+ [nsname getFileSystemRepresentation:name maxLength:MAXPATHLEN];
}
+QFile::KWQFilePrivate::~KWQFilePrivate()
+{
+ free(name);
+}
-QPalette::QPalette(const QPalette &other)
+
+QFile::QFile() : d(new QFile::KWQFilePrivate(QString("")))
{
- d = new QPalettePrivate(other.d);
}
+QFile::QFile(const QString &name) : d(new QFile::KWQFilePrivate(name))
+{
+}
-QPalette::~QPalette()
+QFile::~QFile()
{
delete d;
}
+bool QFile::exists() const
+{
+ return access(d->name, F_OK) == 0;
+}
-void QPalette::setColor(ColorGroup cg, QColorGroup::ColorRole role, const QColor &color)
+bool QFile::open(int mode)
{
- switch (cg) {
- case Active:
- d->active.setColor(role, color);
- break;
- case Inactive:
- d->inactive.setColor(role, color);
- break;
- case Disabled:
- d->disabled.setColor(role, color);
- break;
+ close();
+
+ if (mode == IO_ReadOnly) {
+ d->fd = ::open(d->name, O_RDONLY);
}
-}
+ return d->fd != -1;
+}
-const QColorGroup &QPalette::active() const
+void QFile::close()
{
- return d->active;
-}
+ if (d->fd != -1) {
+ ::close(d->fd);
+ }
+ d->fd = -1;
+}
-const QColorGroup &QPalette::inactive() const
+int QFile::readBlock(char *data, uint bytesToRead)
{
- return d->inactive;
+ if (d->fd == -1) {
+ return -1;
+ } else {
+ return read(d->fd, data, bytesToRead);
+ }
}
-
-const QColorGroup &QPalette::disabled() const
+uint QFile::size() const
{
- return d->disabled;
-}
+ struct stat statbuf;
+ if (stat(d->name, &statbuf) == 0) {
+ return statbuf.st_size;
+ } else {
+ return 0;
+ }
+}
-const QColorGroup &QPalette::normal() const
+bool QFile::exists(const QString &path)
{
- return d->active;
+ return QFile(path).exists();
}
-QPalette &QPalette::operator=(const QPalette &other)
-{
- d->active = other.d->active;
- d->inactive = other.d->inactive;
- d->disabled = other.d->disabled;
- return *this;
-}
+#endif
+
diff --git a/WebCore/kwq/KWQIODevice.h b/WebCore/kwq/KWQIODevice.h
index dbc0d20..1a5bdc2 100644
--- a/WebCore/kwq/KWQIODevice.h
+++ b/WebCore/kwq/KWQIODevice.h
@@ -1,6 +1,32 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef QIODEVICE_H_
#define QIODEVICE_H_
-#define IO_WriteOnly 0x0002 // writable device
+#define IO_WriteOnly 0x0002
+#define IO_ReadOnly 0x0001
#endif
diff --git a/WebCore/kwq/KWQRegExp.h b/WebCore/kwq/KWQRegExp.h
index 2920947..c8bedad 100644
--- a/WebCore/kwq/KWQRegExp.h
+++ b/WebCore/kwq/KWQRegExp.h
@@ -46,7 +46,7 @@ class QRegExp {
public:
QRegExp();
- QRegExp(const QString &, bool, bool);
+ QRegExp(const QString &, bool caseSensitive = TRUE, bool glob = FALSE);
QRegExp(const char *);
QRegExp(const QRegExp &);
~QRegExp();
diff --git a/WebCore/kwq/KWQRegExp.mm b/WebCore/kwq/KWQRegExp.mm
index 43eddb3..5ab1701 100644
--- a/WebCore/kwq/KWQRegExp.mm
+++ b/WebCore/kwq/KWQRegExp.mm
@@ -36,30 +36,63 @@ class QRegExp::KWQRegExpPrivate
{
public:
KWQRegExpPrivate();
- KWQRegExpPrivate(QString pattern);
+ KWQRegExpPrivate(QString pattern, bool caseSensitive, bool glob);
~KWQRegExpPrivate();
- void compile();
+ void compile(bool caseSensitive, bool glob);
QString pattern;
regex_t regex;
+
uint refCount;
};
QRegExp::KWQRegExpPrivate::KWQRegExpPrivate() : pattern(QString("")), refCount(0)
{
- compile();
+ compile(true, false);
}
-QRegExp::KWQRegExpPrivate::KWQRegExpPrivate(QString p) : pattern(p), refCount(0)
+QRegExp::KWQRegExpPrivate::KWQRegExpPrivate(QString p, bool caseSensitive, bool glob) : pattern(p), refCount(0)
{
- compile();
+ compile(caseSensitive, glob);
}
-void QRegExp::KWQRegExpPrivate::compile()
+static QString RegExpFromGlob(QString glob)
{
- const char *cpattern = pattern.latin1();
- regcomp(®ex, cpattern, REG_EXTENDED);
+ QString result = glob;
+
+ // escape regexp metacharacters which are NOT glob metacharacters
+
+ result.replace(QRegExp("\\\\"), "\\\\");
+ result.replace(QRegExp("\\."), "\\.");
+ result.replace(QRegExp("\\+"), "\\+");
+ result.replace(QRegExp("\\$"), "\\$");
+ // FIXME: incorrect for ^ inside bracket group
+ result.replace(QRegExp("\\^"), "\\^");
+
+ // translate glob metacharacters into regexp metacharacters
+ result.replace(QRegExp("\\*"), ".*");
+ result.replace(QRegExp("\\?"), ".");
+
+ // Require the glob to match the whole string
+ result = "^" + result + "$";
+
+ return result;
+}
+
+void QRegExp::KWQRegExpPrivate::compile(bool caseSensitive, bool glob)
+{
+ QString p;
+
+ if (glob) {
+ p = RegExpFromGlob(pattern);
+ } else {
+ p = pattern;
+ }
+
+ const char *cpattern = p.latin1();
+
+ regcomp(®ex, cpattern, REG_EXTENDED | (caseSensitive ? 0 : REG_ICASE));
}
QRegExp::KWQRegExpPrivate::~KWQRegExpPrivate()
@@ -72,11 +105,11 @@ QRegExp::QRegExp() : d(new QRegExp::KWQRegExpPrivate())
{
}
-QRegExp::QRegExp(const QString &pattern, bool, bool) : d(new QRegExp::KWQRegExpPrivate(pattern))
+QRegExp::QRegExp(const QString &pattern, bool caseSensitive, bool glob) : d(new QRegExp::KWQRegExpPrivate(pattern, caseSensitive, glob))
{
}
-QRegExp::QRegExp(const char *cpattern) : d(new QRegExp::KWQRegExpPrivate(cpattern))
+QRegExp::QRegExp(const char *cpattern) : d(new QRegExp::KWQRegExpPrivate(cpattern, true, false))
{
}
diff --git a/WebCore/kwq/KWQStrList.h b/WebCore/kwq/KWQStrList.h
index d718942..a174e08 100644
--- a/WebCore/kwq/KWQStrList.h
+++ b/WebCore/kwq/KWQStrList.h
@@ -34,39 +34,14 @@
#include <_qstrlist.h>
-#else
+#else // !USING_BORROWED_QSTRLIST
-#include <qstring.h>
#include <qlist.h>
// class QStrList ==============================================================
-class QStrList : public QList<char> {
-public:
-
- // structs -----------------------------------------------------------------
- // typedefs ----------------------------------------------------------------
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
- // constructors, copy constructors, and destructors ------------------------
-
- QStrList();
- QStrList(const QStrList &);
- ~QStrList();
-
- // member functions --------------------------------------------------------
-
- // operators ---------------------------------------------------------------
-
- QStrList &operator=(const QStrList &);
-
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
-
-}; // class QStrList ===========================================================
+typedef QList<char> QStrList;
#endif // USING_BORROWED_QSTRLIST
-#endif
+#endif // KWQSTRLIST_H_
diff --git a/WebCore/kwq/Makefile.am b/WebCore/kwq/Makefile.am
index 102996a..856e10d 100644
--- a/WebCore/kwq/Makefile.am
+++ b/WebCore/kwq/Makefile.am
@@ -29,8 +29,10 @@ libkwq_o_SOURCES = \
KWQDCOPClient.mm \
KWQDateTime.mm \
KWQDictImpl.mm \
+ KWQDir.mm \
KWQDrawUtil.mm \
KWQEvent.mm \
+ KWQFile.mm \
KWQFont.mm \
KWQFontDatabase.mm \
KWQFontInfo.mm \
diff --git a/WebCore/kwq/qt/_qdir.h b/WebCore/kwq/qt/_qdir.h
index 3766c47..f0cabd3 100644
--- a/WebCore/kwq/qt/_qdir.h
+++ b/WebCore/kwq/qt/_qdir.h
@@ -38,6 +38,11 @@
#ifndef QDIR_H
#define QDIR_H
+#include <config.h>
+
+#ifdef USING_BORROWED_QDIR
+
+
#ifndef QT_H
#include "_qstrlist.h"
#include "_qfileinfo.h"
@@ -231,5 +236,7 @@ struct QDirSortItem {
QFileInfo* item;
};
+#endif // USING_BORROWED_QDIR
+
#endif // QT_NO_DIR
#endif // QDIR_H
diff --git a/WebCore/src/kwq/qt/qfile.h b/WebCore/kwq/qt/_qfile.h
similarity index 94%
copy from WebCore/src/kwq/qt/qfile.h
copy to WebCore/kwq/qt/_qfile.h
index 7034859..bfbb8f9 100644
--- a/WebCore/src/kwq/qt/qfile.h
+++ b/WebCore/kwq/qt/_qfile.h
@@ -23,19 +23,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef QFILE_H_
-#define QFILE_H_
+#ifndef _QFILE_H_
+#define _QFILE_H_
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
+
+#ifdef USING_BORROWED_QFILE
#include <KWQDef.h>
// USING_BORROWED_QFILE =======================================================
-#ifdef USING_BORROWED_QFILE
-
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -118,9 +116,6 @@ struct QFileInfoCache
};
-#endif // USING_BORROWED_QFILE
-
-
#include "_qiodevice.h"
#include "qstring.h"
#include "qcstring.h"
@@ -133,23 +128,19 @@ public:
// typedefs ----------------------------------------------------------------
-#ifdef USING_BORROWED_QFILE
typedef QCString(*EncoderFn)(const QString &);
typedef QString(*DecoderFn)(const QCString &);
-#endif
// enums -------------------------------------------------------------------
// constants ---------------------------------------------------------------
// static member functions -------------------------------------------------
-#ifdef USING_BORROWED_QFILE
static QCString encodeName(const QString &);
static QString decodeName(const QCString &);
static void setEncodingFunction(EncoderFn);
static void setDecodingFunction(DecoderFn);
static bool exists(const QString &);
static bool remove(const QString &fileName);
-#endif
// constructors, copy constructors, and destructors ------------------------
@@ -166,7 +157,6 @@ public:
uint size() const;
-#ifdef USING_BORROWED_QFILE
bool remove();
QString name() const;
@@ -190,13 +180,11 @@ public:
int ungetch(int);
int handle() const;
-#endif
// operators ---------------------------------------------------------------
// protected -------------------------------------------------------------------
-#ifdef USING_BORROWED_QFILE
protected:
QString fn;
FILE *fh;
@@ -204,8 +192,6 @@ protected:
int length;
bool ext_f;
void *d;
-#endif
-
// private ---------------------------------------------------------------------
@@ -215,15 +201,11 @@ private:
QFile(const QFile &);
QFile &operator=(const QFile &);
-#ifdef USING_BORROWED_QFILE
void init();
QCString ungetchBuffer;
-#endif
}; // class QFile ==============================================================
-#ifdef USING_BORROWED_QFILE
-
inline int QFile::at() const
{
return ioIndex;
@@ -235,4 +217,4 @@ inline QString QFile::name() const
#endif // USING_BORROWED_QFILE
-#endif
+#endif // _QFILE_H
diff --git a/WebCore/kwq/qt/_qfileinfo.h b/WebCore/kwq/qt/_qfileinfo.h
index 8543e1c..0997940 100644
--- a/WebCore/kwq/qt/_qfileinfo.h
+++ b/WebCore/kwq/qt/_qfileinfo.h
@@ -38,6 +38,8 @@
#ifndef QFILEINFO_H
#define QFILEINFO_H
+#ifdef USING_BORROWED_QFILEINFO
+
#ifndef QT_H
#include "qfile.h"
#include "qdatetime.h"
@@ -134,5 +136,6 @@ inline bool QFileInfo::caching() const
return cache;
}
+#endif USING_BORROWED_QFILEINFO
#endif // QFILEINFO_H
diff --git a/WebCore/kwq/qt/qdir.h b/WebCore/kwq/qt/qdir.h
index 47e5a2c..fcfe50b 100644
--- a/WebCore/kwq/qt/qdir.h
+++ b/WebCore/kwq/qt/qdir.h
@@ -56,23 +56,25 @@ public:
QDir();
QDir(const QString &);
QDir(const QDir &);
- virtual ~QDir();
+ ~QDir();
// member functions --------------------------------------------------------
- virtual QString absPath() const;
- virtual QString absFilePath( const QString &fileName) const;
- virtual bool cdUp();
- virtual bool exists(const QString&) const;
- virtual QStringList entryList(const QString &nameFilter);
+ QString absPath() const;
+ QString absFilePath( const QString &fileName) const;
+ bool cdUp();
+ bool exists(const QString&) const;
+ QStringList entryList(const QString &nameFilter);
// operators ---------------------------------------------------------------
QDir &operator=(const QDir &);
+ private:
+ void swap(QDir &other);
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
+ class KWQDirPrivate;
+ KWQDirPrivate *d;
}; // class QDir ===============================================================
#endif // USING_BORROWED_QDIR
diff --git a/WebCore/kwq/qt/qfile.h b/WebCore/kwq/qt/qfile.h
index 7034859..30fc90e 100644
--- a/WebCore/kwq/qt/qfile.h
+++ b/WebCore/kwq/qt/qfile.h
@@ -36,178 +36,27 @@
#ifdef USING_BORROWED_QFILE
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <limits.h>
-
-#if !defined(PATH_MAX)
-#if defined(MAXPATHLEN)
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
+#include <_qfile.h>
-#undef STATBUF
-#undef STAT
-#undef STAT_REG
-#undef STAT_DIR
-#undef STAT_LNK
-#undef STAT_MASK
-#undef FILENO
-#undef OPEN
-#undef CLOSE
-#undef LSEEK
-#undef READ
-#undef WRITE
-#undef ACCESS
-#undef GETCWD
-#undef CHDIR
-#undef MKDIR
-#undef RMDIR
-#undef OPEN_RDONLY
-#undef OPEN_WRONLY
-#undef OPEN_CREAT
-#undef OPEN_TRUNC
-#undef OPEN_APPEND
-#undef OPEN_TEXT
-#undef OPEN_BINARY
-
-#define STATBUF struct stat
-#define STATBUF4TSTAT struct stat
-#define STAT ::stat
-#define FSTAT ::fstat
-#define STAT_REG S_IFREG
-#define STAT_DIR S_IFDIR
-#define STAT_MASK S_IFMT
-#if defined(S_IFLNK)
-# define STAT_LNK S_IFLNK
-#endif
-#define FILENO fileno
-#define OPEN ::open
-#define CLOSE ::close
-#define LSEEK ::lseek
-#define READ ::read
-#define WRITE ::write
-#define ACCESS ::access
-#define GETCWD ::getcwd
-#define CHDIR ::chdir
-#define MKDIR ::mkdir
-#define RMDIR ::rmdir
-#define OPEN_RDONLY O_RDONLY
-#define OPEN_WRONLY O_WRONLY
-#define OPEN_RDWR O_RDWR
-#define OPEN_CREAT O_CREAT
-#define OPEN_TRUNC O_TRUNC
-#define OPEN_APPEND O_APPEND
-#if defined(O_TEXT)
-# define OPEN_TEXT O_TEXT
-# define OPEN_BINARY O_BINARY
-#endif
+#else // !USING_BORROWED_QFILE
-#define F_OK 0
+#include <qstring.h>
+#include <qiodevice.h>
-struct QFileInfoCache
+class QFile
{
- STATBUF st;
- bool isSymLink;
-};
-
-
-#endif // USING_BORROWED_QFILE
-
-
-#include "_qiodevice.h"
-#include "qstring.h"
-#include "qcstring.h"
-
-
-// class QFile =================================================================
-
-class QFile : public QIODevice {
public:
-
- // typedefs ----------------------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
- typedef QCString(*EncoderFn)(const QString &);
- typedef QString(*DecoderFn)(const QCString &);
-#endif
-
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
- static QCString encodeName(const QString &);
- static QString decodeName(const QCString &);
- static void setEncodingFunction(EncoderFn);
- static void setDecodingFunction(DecoderFn);
- static bool exists(const QString &);
- static bool remove(const QString &fileName);
-#endif
-
- // constructors, copy constructors, and destructors ------------------------
-
QFile();
QFile(const QString &);
~QFile();
- // member functions --------------------------------------------------------
-
bool exists() const;
bool open(int);
void close();
int readBlock(char *, uint);
uint size() const;
-
-#ifdef USING_BORROWED_QFILE
- bool remove();
-
- QString name() const;
- void setName(const QString &);
-
- bool open(int, FILE *);
- bool open(int, int);
- void flush();
-
- int at() const;
- bool at(int);
- bool atEnd() const;
-
- int writeBlock(const char *, uint);
- int writeBlock(const QByteArray &);
- int readLine(char *, uint);
- int readLine(QString &, uint);
-
- int getch();
- int putch(int);
- int ungetch(int);
-
- int handle() const;
-#endif
-
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
-protected:
- QString fn;
- FILE *fh;
- int fd;
- int length;
- bool ext_f;
- void *d;
-#endif
-
-
-// private ---------------------------------------------------------------------
+ static bool exists(const QString &path);
private:
// no copying or assignment
@@ -215,24 +64,12 @@ private:
QFile(const QFile &);
QFile &operator=(const QFile &);
-#ifdef USING_BORROWED_QFILE
- void init();
- QCString ungetchBuffer;
-#endif
-
-}; // class QFile ==============================================================
+ class KWQFilePrivate;
-#ifdef USING_BORROWED_QFILE
-
-inline int QFile::at() const
-{
- return ioIndex;
-}
-
-inline QString QFile::name() const
-{ return fn; }
+ KWQFilePrivate *d;
+};
#endif // USING_BORROWED_QFILE
-#endif
+#endif // QFILE_H_
diff --git a/WebCore/kwq/qt/qiodevice.h b/WebCore/kwq/qt/qiodevice.h
index dbc0d20..1a5bdc2 100644
--- a/WebCore/kwq/qt/qiodevice.h
+++ b/WebCore/kwq/qt/qiodevice.h
@@ -1,6 +1,32 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef QIODEVICE_H_
#define QIODEVICE_H_
-#define IO_WriteOnly 0x0002 // writable device
+#define IO_WriteOnly 0x0002
+#define IO_ReadOnly 0x0001
#endif
diff --git a/WebCore/kwq/qt/qregexp.h b/WebCore/kwq/qt/qregexp.h
index 2920947..c8bedad 100644
--- a/WebCore/kwq/qt/qregexp.h
+++ b/WebCore/kwq/qt/qregexp.h
@@ -46,7 +46,7 @@ class QRegExp {
public:
QRegExp();
- QRegExp(const QString &, bool, bool);
+ QRegExp(const QString &, bool caseSensitive = TRUE, bool glob = FALSE);
QRegExp(const char *);
QRegExp(const QRegExp &);
~QRegExp();
diff --git a/WebCore/src/kwq/KWQDir.mm b/WebCore/src/kwq/KWQDir.mm
new file mode 100644
index 0000000..724ef07
--- /dev/null
+++ b/WebCore/src/kwq/KWQDir.mm
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <qdir.h>
+
+#ifndef USING_BORROWED_QDIR
+
+#include <kwqdebug.h>
+#import <Foundation/Foundation.h>
+
+#include <qfile.h>
+#include <qstring.h>
+#include <qregexp.h>
+#include <sys/param.h>
+#include <unistd.h>
+
+class QDir::KWQDirPrivate
+{
+public:
+ KWQDirPrivate(const QString &n);
+ KWQDirPrivate(const KWQDirPrivate &other);
+ ~KWQDirPrivate();
+
+ QString name;
+};
+
+QDir::KWQDirPrivate::KWQDirPrivate(const QString &n) : name(n)
+{
+}
+
+QDir::KWQDirPrivate::KWQDirPrivate(const KWQDirPrivate &other) : name(other.name)
+{
+}
+
+QDir::KWQDirPrivate::~KWQDirPrivate()
+{
+}
+
+
+
+QDir::QDir() : d(new QDir::KWQDirPrivate(QString(".")))
+{
+}
+
+QDir::QDir(const QString &name) : d(new QDir::KWQDirPrivate(name))
+{
+}
+
+QDir::QDir(const QDir &other) : d(new QDir::KWQDirPrivate(*other.d))
+{
+}
+
+QDir::~QDir()
+{
+ delete d;
+}
+
+QString QDir::absPath() const
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ QString path;
+ if (d->name[0] == '/') {
+ path = d->name;
+ } else {
+ QString cwdString = QString::fromCFString((CFStringRef)[[NSFileManager defaultManager] currentDirectoryPath]);
+
+ if (cwdString[cwdString.length()-1] != '/') {
+ cwdString += '/';
+ }
+
+ path = cwdString + d->name;
+ }
+
+ // Resolve . and ..
+ path.replace(QRegExp("/./"), "/");
+ path.replace(QRegExp("/[^/]*/../"), "/");
+ path.replace(QRegExp("/[^/]*/..$"), "");
+
+ [pool release];
+ return path;
+}
+
+QString QDir::absFilePath(const QString &fileName) const
+{
+ QString dirPath = absPath();
+
+ if (dirPath[dirPath.length()-1] != '/') {
+ dirPath = dirPath + "/";
+ }
+
+ return dirPath + fileName;
+}
+
+bool QDir::cdUp()
+{
+ QString dirPath = absPath();
+
+ if (dirPath[dirPath.length()-1] != '/') {
+ dirPath += "/";
+ }
+
+ dirPath += "..";
+
+ dirPath.replace(QRegExp("/[^/]*/..$"), "");
+
+ if (QFile::exists(dirPath)) {
+ d->name = dirPath;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool QDir::exists(const QString &fileName) const
+{
+ return QFile::exists(absFilePath(fileName));
+}
+
+QStringList QDir::entryList(const QString &nameFilter)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ QStringList results;
+ {
+ QRegExp filter(nameFilter, TRUE, TRUE);
+
+ NSArray *contents = [[NSFileManager defaultManager] directoryContentsAtPath:(NSString *)(absPath().getCFMutableString())];
+
+ contents = [contents arrayByAddingObjectsFromArray:[NSArray arrayWithObjects:@".", @"..", nil]];
+ contents = [contents sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
+
+ unsigned length = [contents count];
+
+ for (unsigned i = 0; i < length; i++) {
+ QString item = QString::fromCFString((CFStringRef)[contents objectAtIndex:i]);
+
+ if (item.find(filter) != -1 && QFile::exists(absFilePath(item))) {
+ results.append(item);
+ }
+ }
+ }
+
+ [pool release];
+ return results;
+}
+
+QDir &QDir::operator=(const QDir &other)
+{
+ QDir tmp(other);
+
+ swap (tmp);
+
+ return *this;
+}
+
+void QDir::swap(QDir &other)
+{
+ QDir::KWQDirPrivate *tmp;
+
+ tmp = other.d;
+ other.d = d;
+ d = tmp;
+}
+
+#endif
+
diff --git a/WebCore/kwq/KWQPalette.mm b/WebCore/src/kwq/KWQFile.mm
similarity index 50%
copy from WebCore/kwq/KWQPalette.mm
copy to WebCore/src/kwq/KWQFile.mm
index 6dfe312..3d33669 100644
--- a/WebCore/kwq/KWQPalette.mm
+++ b/WebCore/src/kwq/KWQFile.mm
@@ -23,94 +23,108 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <qpalette.h>
+#include <qfile.h>
+#ifndef USING_BORROWED_QFILE
-class QPalettePrivate
+#include <kwqdebug.h>
+#import <Foundation/Foundation.h>
+#include <sys/param.h>
+#include <qstring.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <qiodevice.h>
+
+class QFile::KWQFilePrivate
{
-friend class QPalette;
public:
- QPalettePrivate() : active(), inactive(), disabled()
- {
- }
+ KWQFilePrivate(const QString &name);
+ ~KWQFilePrivate();
- QPalettePrivate(const QPalettePrivate *other) :
- active(other->active),
- inactive(other->inactive),
- disabled(other->disabled)
- {
- }
-
-private:
- QColorGroup active;
- QColorGroup inactive;
- QColorGroup disabled;
+ char *name;
+ int fd;
};
-#include <kwqdebug.h>
-QPalette::QPalette()
+QFile::KWQFilePrivate::KWQFilePrivate(const QString &qname) : name(malloc(sizeof(char) * MAXPATHLEN)), fd(-1)
{
- d = new QPalettePrivate();
+ NSString *nsname = (NSString *)qname.getCFMutableString();
+
+ [nsname getFileSystemRepresentation:name maxLength:MAXPATHLEN];
}
+QFile::KWQFilePrivate::~KWQFilePrivate()
+{
+ free(name);
+}
-QPalette::QPalette(const QPalette &other)
+
+QFile::QFile() : d(new QFile::KWQFilePrivate(QString("")))
{
- d = new QPalettePrivate(other.d);
}
+QFile::QFile(const QString &name) : d(new QFile::KWQFilePrivate(name))
+{
+}
-QPalette::~QPalette()
+QFile::~QFile()
{
delete d;
}
+bool QFile::exists() const
+{
+ return access(d->name, F_OK) == 0;
+}
-void QPalette::setColor(ColorGroup cg, QColorGroup::ColorRole role, const QColor &color)
+bool QFile::open(int mode)
{
- switch (cg) {
- case Active:
- d->active.setColor(role, color);
- break;
- case Inactive:
- d->inactive.setColor(role, color);
- break;
- case Disabled:
- d->disabled.setColor(role, color);
- break;
+ close();
+
+ if (mode == IO_ReadOnly) {
+ d->fd = ::open(d->name, O_RDONLY);
}
-}
+ return d->fd != -1;
+}
-const QColorGroup &QPalette::active() const
+void QFile::close()
{
- return d->active;
-}
+ if (d->fd != -1) {
+ ::close(d->fd);
+ }
+ d->fd = -1;
+}
-const QColorGroup &QPalette::inactive() const
+int QFile::readBlock(char *data, uint bytesToRead)
{
- return d->inactive;
+ if (d->fd == -1) {
+ return -1;
+ } else {
+ return read(d->fd, data, bytesToRead);
+ }
}
-
-const QColorGroup &QPalette::disabled() const
+uint QFile::size() const
{
- return d->disabled;
-}
+ struct stat statbuf;
+ if (stat(d->name, &statbuf) == 0) {
+ return statbuf.st_size;
+ } else {
+ return 0;
+ }
+}
-const QColorGroup &QPalette::normal() const
+bool QFile::exists(const QString &path)
{
- return d->active;
+ return QFile(path).exists();
}
-QPalette &QPalette::operator=(const QPalette &other)
-{
- d->active = other.d->active;
- d->inactive = other.d->inactive;
- d->disabled = other.d->disabled;
- return *this;
-}
+#endif
+
diff --git a/WebCore/src/kwq/KWQRegExp.mm b/WebCore/src/kwq/KWQRegExp.mm
index 43eddb3..5ab1701 100644
--- a/WebCore/src/kwq/KWQRegExp.mm
+++ b/WebCore/src/kwq/KWQRegExp.mm
@@ -36,30 +36,63 @@ class QRegExp::KWQRegExpPrivate
{
public:
KWQRegExpPrivate();
- KWQRegExpPrivate(QString pattern);
+ KWQRegExpPrivate(QString pattern, bool caseSensitive, bool glob);
~KWQRegExpPrivate();
- void compile();
+ void compile(bool caseSensitive, bool glob);
QString pattern;
regex_t regex;
+
uint refCount;
};
QRegExp::KWQRegExpPrivate::KWQRegExpPrivate() : pattern(QString("")), refCount(0)
{
- compile();
+ compile(true, false);
}
-QRegExp::KWQRegExpPrivate::KWQRegExpPrivate(QString p) : pattern(p), refCount(0)
+QRegExp::KWQRegExpPrivate::KWQRegExpPrivate(QString p, bool caseSensitive, bool glob) : pattern(p), refCount(0)
{
- compile();
+ compile(caseSensitive, glob);
}
-void QRegExp::KWQRegExpPrivate::compile()
+static QString RegExpFromGlob(QString glob)
{
- const char *cpattern = pattern.latin1();
- regcomp(®ex, cpattern, REG_EXTENDED);
+ QString result = glob;
+
+ // escape regexp metacharacters which are NOT glob metacharacters
+
+ result.replace(QRegExp("\\\\"), "\\\\");
+ result.replace(QRegExp("\\."), "\\.");
+ result.replace(QRegExp("\\+"), "\\+");
+ result.replace(QRegExp("\\$"), "\\$");
+ // FIXME: incorrect for ^ inside bracket group
+ result.replace(QRegExp("\\^"), "\\^");
+
+ // translate glob metacharacters into regexp metacharacters
+ result.replace(QRegExp("\\*"), ".*");
+ result.replace(QRegExp("\\?"), ".");
+
+ // Require the glob to match the whole string
+ result = "^" + result + "$";
+
+ return result;
+}
+
+void QRegExp::KWQRegExpPrivate::compile(bool caseSensitive, bool glob)
+{
+ QString p;
+
+ if (glob) {
+ p = RegExpFromGlob(pattern);
+ } else {
+ p = pattern;
+ }
+
+ const char *cpattern = p.latin1();
+
+ regcomp(®ex, cpattern, REG_EXTENDED | (caseSensitive ? 0 : REG_ICASE));
}
QRegExp::KWQRegExpPrivate::~KWQRegExpPrivate()
@@ -72,11 +105,11 @@ QRegExp::QRegExp() : d(new QRegExp::KWQRegExpPrivate())
{
}
-QRegExp::QRegExp(const QString &pattern, bool, bool) : d(new QRegExp::KWQRegExpPrivate(pattern))
+QRegExp::QRegExp(const QString &pattern, bool caseSensitive, bool glob) : d(new QRegExp::KWQRegExpPrivate(pattern, caseSensitive, glob))
{
}
-QRegExp::QRegExp(const char *cpattern) : d(new QRegExp::KWQRegExpPrivate(cpattern))
+QRegExp::QRegExp(const char *cpattern) : d(new QRegExp::KWQRegExpPrivate(cpattern, true, false))
{
}
diff --git a/WebCore/src/kwq/KWQStrList.h b/WebCore/src/kwq/KWQStrList.h
index d718942..a174e08 100644
--- a/WebCore/src/kwq/KWQStrList.h
+++ b/WebCore/src/kwq/KWQStrList.h
@@ -34,39 +34,14 @@
#include <_qstrlist.h>
-#else
+#else // !USING_BORROWED_QSTRLIST
-#include <qstring.h>
#include <qlist.h>
// class QStrList ==============================================================
-class QStrList : public QList<char> {
-public:
-
- // structs -----------------------------------------------------------------
- // typedefs ----------------------------------------------------------------
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
- // constructors, copy constructors, and destructors ------------------------
-
- QStrList();
- QStrList(const QStrList &);
- ~QStrList();
-
- // member functions --------------------------------------------------------
-
- // operators ---------------------------------------------------------------
-
- QStrList &operator=(const QStrList &);
-
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
-
-}; // class QStrList ===========================================================
+typedef QList<char> QStrList;
#endif // USING_BORROWED_QSTRLIST
-#endif
+#endif // KWQSTRLIST_H_
diff --git a/WebCore/src/kwq/Makefile.am b/WebCore/src/kwq/Makefile.am
index 102996a..856e10d 100644
--- a/WebCore/src/kwq/Makefile.am
+++ b/WebCore/src/kwq/Makefile.am
@@ -29,8 +29,10 @@ libkwq_o_SOURCES = \
KWQDCOPClient.mm \
KWQDateTime.mm \
KWQDictImpl.mm \
+ KWQDir.mm \
KWQDrawUtil.mm \
KWQEvent.mm \
+ KWQFile.mm \
KWQFont.mm \
KWQFontDatabase.mm \
KWQFontInfo.mm \
diff --git a/WebCore/src/kwq/qt/_qdir.h b/WebCore/src/kwq/qt/_qdir.h
index 3766c47..f0cabd3 100644
--- a/WebCore/src/kwq/qt/_qdir.h
+++ b/WebCore/src/kwq/qt/_qdir.h
@@ -38,6 +38,11 @@
#ifndef QDIR_H
#define QDIR_H
+#include <config.h>
+
+#ifdef USING_BORROWED_QDIR
+
+
#ifndef QT_H
#include "_qstrlist.h"
#include "_qfileinfo.h"
@@ -231,5 +236,7 @@ struct QDirSortItem {
QFileInfo* item;
};
+#endif // USING_BORROWED_QDIR
+
#endif // QT_NO_DIR
#endif // QDIR_H
diff --git a/WebCore/src/kwq/qt/qfile.h b/WebCore/src/kwq/qt/_qfile.h
similarity index 94%
copy from WebCore/src/kwq/qt/qfile.h
copy to WebCore/src/kwq/qt/_qfile.h
index 7034859..bfbb8f9 100644
--- a/WebCore/src/kwq/qt/qfile.h
+++ b/WebCore/src/kwq/qt/_qfile.h
@@ -23,19 +23,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef QFILE_H_
-#define QFILE_H_
+#ifndef _QFILE_H_
+#define _QFILE_H_
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
+
+#ifdef USING_BORROWED_QFILE
#include <KWQDef.h>
// USING_BORROWED_QFILE =======================================================
-#ifdef USING_BORROWED_QFILE
-
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -118,9 +116,6 @@ struct QFileInfoCache
};
-#endif // USING_BORROWED_QFILE
-
-
#include "_qiodevice.h"
#include "qstring.h"
#include "qcstring.h"
@@ -133,23 +128,19 @@ public:
// typedefs ----------------------------------------------------------------
-#ifdef USING_BORROWED_QFILE
typedef QCString(*EncoderFn)(const QString &);
typedef QString(*DecoderFn)(const QCString &);
-#endif
// enums -------------------------------------------------------------------
// constants ---------------------------------------------------------------
// static member functions -------------------------------------------------
-#ifdef USING_BORROWED_QFILE
static QCString encodeName(const QString &);
static QString decodeName(const QCString &);
static void setEncodingFunction(EncoderFn);
static void setDecodingFunction(DecoderFn);
static bool exists(const QString &);
static bool remove(const QString &fileName);
-#endif
// constructors, copy constructors, and destructors ------------------------
@@ -166,7 +157,6 @@ public:
uint size() const;
-#ifdef USING_BORROWED_QFILE
bool remove();
QString name() const;
@@ -190,13 +180,11 @@ public:
int ungetch(int);
int handle() const;
-#endif
// operators ---------------------------------------------------------------
// protected -------------------------------------------------------------------
-#ifdef USING_BORROWED_QFILE
protected:
QString fn;
FILE *fh;
@@ -204,8 +192,6 @@ protected:
int length;
bool ext_f;
void *d;
-#endif
-
// private ---------------------------------------------------------------------
@@ -215,15 +201,11 @@ private:
QFile(const QFile &);
QFile &operator=(const QFile &);
-#ifdef USING_BORROWED_QFILE
void init();
QCString ungetchBuffer;
-#endif
}; // class QFile ==============================================================
-#ifdef USING_BORROWED_QFILE
-
inline int QFile::at() const
{
return ioIndex;
@@ -235,4 +217,4 @@ inline QString QFile::name() const
#endif // USING_BORROWED_QFILE
-#endif
+#endif // _QFILE_H
diff --git a/WebCore/src/kwq/qt/_qfileinfo.h b/WebCore/src/kwq/qt/_qfileinfo.h
index 8543e1c..0997940 100644
--- a/WebCore/src/kwq/qt/_qfileinfo.h
+++ b/WebCore/src/kwq/qt/_qfileinfo.h
@@ -38,6 +38,8 @@
#ifndef QFILEINFO_H
#define QFILEINFO_H
+#ifdef USING_BORROWED_QFILEINFO
+
#ifndef QT_H
#include "qfile.h"
#include "qdatetime.h"
@@ -134,5 +136,6 @@ inline bool QFileInfo::caching() const
return cache;
}
+#endif USING_BORROWED_QFILEINFO
#endif // QFILEINFO_H
diff --git a/WebCore/src/kwq/qt/qdir.h b/WebCore/src/kwq/qt/qdir.h
index 47e5a2c..fcfe50b 100644
--- a/WebCore/src/kwq/qt/qdir.h
+++ b/WebCore/src/kwq/qt/qdir.h
@@ -56,23 +56,25 @@ public:
QDir();
QDir(const QString &);
QDir(const QDir &);
- virtual ~QDir();
+ ~QDir();
// member functions --------------------------------------------------------
- virtual QString absPath() const;
- virtual QString absFilePath( const QString &fileName) const;
- virtual bool cdUp();
- virtual bool exists(const QString&) const;
- virtual QStringList entryList(const QString &nameFilter);
+ QString absPath() const;
+ QString absFilePath( const QString &fileName) const;
+ bool cdUp();
+ bool exists(const QString&) const;
+ QStringList entryList(const QString &nameFilter);
// operators ---------------------------------------------------------------
QDir &operator=(const QDir &);
+ private:
+ void swap(QDir &other);
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
+ class KWQDirPrivate;
+ KWQDirPrivate *d;
}; // class QDir ===============================================================
#endif // USING_BORROWED_QDIR
diff --git a/WebCore/src/kwq/qt/qfile.h b/WebCore/src/kwq/qt/qfile.h
index 7034859..30fc90e 100644
--- a/WebCore/src/kwq/qt/qfile.h
+++ b/WebCore/src/kwq/qt/qfile.h
@@ -36,178 +36,27 @@
#ifdef USING_BORROWED_QFILE
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <limits.h>
-
-#if !defined(PATH_MAX)
-#if defined(MAXPATHLEN)
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
+#include <_qfile.h>
-#undef STATBUF
-#undef STAT
-#undef STAT_REG
-#undef STAT_DIR
-#undef STAT_LNK
-#undef STAT_MASK
-#undef FILENO
-#undef OPEN
-#undef CLOSE
-#undef LSEEK
-#undef READ
-#undef WRITE
-#undef ACCESS
-#undef GETCWD
-#undef CHDIR
-#undef MKDIR
-#undef RMDIR
-#undef OPEN_RDONLY
-#undef OPEN_WRONLY
-#undef OPEN_CREAT
-#undef OPEN_TRUNC
-#undef OPEN_APPEND
-#undef OPEN_TEXT
-#undef OPEN_BINARY
-
-#define STATBUF struct stat
-#define STATBUF4TSTAT struct stat
-#define STAT ::stat
-#define FSTAT ::fstat
-#define STAT_REG S_IFREG
-#define STAT_DIR S_IFDIR
-#define STAT_MASK S_IFMT
-#if defined(S_IFLNK)
-# define STAT_LNK S_IFLNK
-#endif
-#define FILENO fileno
-#define OPEN ::open
-#define CLOSE ::close
-#define LSEEK ::lseek
-#define READ ::read
-#define WRITE ::write
-#define ACCESS ::access
-#define GETCWD ::getcwd
-#define CHDIR ::chdir
-#define MKDIR ::mkdir
-#define RMDIR ::rmdir
-#define OPEN_RDONLY O_RDONLY
-#define OPEN_WRONLY O_WRONLY
-#define OPEN_RDWR O_RDWR
-#define OPEN_CREAT O_CREAT
-#define OPEN_TRUNC O_TRUNC
-#define OPEN_APPEND O_APPEND
-#if defined(O_TEXT)
-# define OPEN_TEXT O_TEXT
-# define OPEN_BINARY O_BINARY
-#endif
+#else // !USING_BORROWED_QFILE
-#define F_OK 0
+#include <qstring.h>
+#include <qiodevice.h>
-struct QFileInfoCache
+class QFile
{
- STATBUF st;
- bool isSymLink;
-};
-
-
-#endif // USING_BORROWED_QFILE
-
-
-#include "_qiodevice.h"
-#include "qstring.h"
-#include "qcstring.h"
-
-
-// class QFile =================================================================
-
-class QFile : public QIODevice {
public:
-
- // typedefs ----------------------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
- typedef QCString(*EncoderFn)(const QString &);
- typedef QString(*DecoderFn)(const QCString &);
-#endif
-
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
- static QCString encodeName(const QString &);
- static QString decodeName(const QCString &);
- static void setEncodingFunction(EncoderFn);
- static void setDecodingFunction(DecoderFn);
- static bool exists(const QString &);
- static bool remove(const QString &fileName);
-#endif
-
- // constructors, copy constructors, and destructors ------------------------
-
QFile();
QFile(const QString &);
~QFile();
- // member functions --------------------------------------------------------
-
bool exists() const;
bool open(int);
void close();
int readBlock(char *, uint);
uint size() const;
-
-#ifdef USING_BORROWED_QFILE
- bool remove();
-
- QString name() const;
- void setName(const QString &);
-
- bool open(int, FILE *);
- bool open(int, int);
- void flush();
-
- int at() const;
- bool at(int);
- bool atEnd() const;
-
- int writeBlock(const char *, uint);
- int writeBlock(const QByteArray &);
- int readLine(char *, uint);
- int readLine(QString &, uint);
-
- int getch();
- int putch(int);
- int ungetch(int);
-
- int handle() const;
-#endif
-
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-
-#ifdef USING_BORROWED_QFILE
-protected:
- QString fn;
- FILE *fh;
- int fd;
- int length;
- bool ext_f;
- void *d;
-#endif
-
-
-// private ---------------------------------------------------------------------
+ static bool exists(const QString &path);
private:
// no copying or assignment
@@ -215,24 +64,12 @@ private:
QFile(const QFile &);
QFile &operator=(const QFile &);
-#ifdef USING_BORROWED_QFILE
- void init();
- QCString ungetchBuffer;
-#endif
-
-}; // class QFile ==============================================================
+ class KWQFilePrivate;
-#ifdef USING_BORROWED_QFILE
-
-inline int QFile::at() const
-{
- return ioIndex;
-}
-
-inline QString QFile::name() const
-{ return fn; }
+ KWQFilePrivate *d;
+};
#endif // USING_BORROWED_QFILE
-#endif
+#endif // QFILE_H_
diff --git a/WebCore/src/kwq/qt/qiodevice.h b/WebCore/src/kwq/qt/qiodevice.h
index dbc0d20..1a5bdc2 100644
--- a/WebCore/src/kwq/qt/qiodevice.h
+++ b/WebCore/src/kwq/qt/qiodevice.h
@@ -1,6 +1,32 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef QIODEVICE_H_
#define QIODEVICE_H_
-#define IO_WriteOnly 0x0002 // writable device
+#define IO_WriteOnly 0x0002
+#define IO_ReadOnly 0x0001
#endif
diff --git a/WebCore/src/kwq/qt/qregexp.h b/WebCore/src/kwq/qt/qregexp.h
index 2920947..c8bedad 100644
--- a/WebCore/src/kwq/qt/qregexp.h
+++ b/WebCore/src/kwq/qt/qregexp.h
@@ -46,7 +46,7 @@ class QRegExp {
public:
QRegExp();
- QRegExp(const QString &, bool, bool);
+ QRegExp(const QString &, bool caseSensitive = TRUE, bool glob = FALSE);
QRegExp(const char *);
QRegExp(const QRegExp &);
~QRegExp();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list