Commit 7134150a authored by kocienda's avatar kocienda

Started making modifications that will move us towards a working Qt

layer. This includes adding many temporary _q<foo> files that are mostly
"borrowed" from Qt for the time being. So far, some basic leaf classes,
and some string stuff is ready and working.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e61fab4
This diff is collapsed.
......@@ -27,6 +27,8 @@ SUBDIRS = \
src/kdelibs/khtml/java \
src/kdelibs/khtml/html \
src/kdelibs/khtml/rendering \
src/kwq/qt \
src/kwq/tests/qt \
$(NULL)
#----------------------------------------------------------------------
......
......@@ -27,12 +27,12 @@ $(filter %.o,$(COBJECTS)): %.o: %.c
$(CC) $(CFLAGS) -I$(TOPSRCDIR) -c $< -o $@
$(filter %.o,$(CXXOBJECTS)): %.o: %.cpp
$(CC) $(CXXFLAGS) -I$(TOPSRCDIR) -c $< -o $@
$(CXX) $(CXXFLAGS) -I$(TOPSRCDIR) -c $< -o $@
.SUFFIXES: .cpp .h .c
.cpp.o:
$(CC) $(CXXFLAGS) -I$(TOPSRCDIR) -c $< -o $@
$(CXX) $(CXXFLAGS) -I$(TOPSRCDIR) -c $< -o $@
#----------------------------------------------------------------------
# Standard subdir targets
......
......@@ -29,6 +29,7 @@ CLEAN_FILES =
# Executables
CC = @CC@
CXX = @CXX@
AR = @AR@
LEX = @LEX@
YACC = @YACC@
......
This diff is collapsed.
......@@ -48,6 +48,8 @@ SUBDIRS='
src/kdelibs/khtml/java
src/kdelibs/khtml/html
src/kdelibs/khtml/rendering
src/kwq/qt
src/kwq/tests/qt
'
for subdir in $SUBDIRS; do
if (test -f "./$subdir/MakeSystemChanges.sh"); then
......@@ -87,6 +89,11 @@ if test -z "$ac_cv_prog_CC"; then
$CONFIG_ERR cc
exit 1
fi
AC_PROG_CXX
if test -z "$ac_cv_prog_CXX"; then
$CONFIG_ERR c++
exit 1
fi
CFLAGS="-DHAVE_CONFIG_H"
AC_SUBST(CFLAGS)
CXXFLAGS=$CFLAGS
......@@ -231,5 +238,7 @@ AC_OUTPUT(
src/kdelibs/khtml/java/Makefile
src/kdelibs/khtml/html/Makefile
src/kdelibs/khtml/rendering/Makefile
src/kwq/qt/Makefile
src/kwq/tests/qt/Makefile
)
......@@ -30,12 +30,18 @@
#include <config.h>
#endif
// _KWQ_COMPLETE_ ==============================================================
#ifdef _KWQ_COMPLETE_
#include <_qcstring.h>
#else
// FIXME: does our implementation of QCString really need to inherit from
// QByteArray and QArray?
// added to help in compilation of khtml/khtml_part.h:811
#include "qarray.h"
#include <iostream>
#include <string.h>
typedef QArray<char> QByteArray;
......@@ -58,18 +64,18 @@ public:
QCString(const char *, uint);
QCString(const QCString &);
~QCString();
~QCString() {}
// member functions --------------------------------------------------------
bool isEmpty() const;
bool isNull() const;
int find(const char *str, int index=0, bool cs=TRUE) const;
int contains(char) const;
int find(const char *, int index=0, bool cs=TRUE) const;
int contains(char, bool cs=TRUE) const;
uint length() const;
bool truncate(uint);
QCString lower() const;
QCString mid(uint index, uint len=0xffffffff) const;
QCString mid(uint, uint len=0xffffffff) const;
// operators ---------------------------------------------------------------
......@@ -79,6 +85,10 @@ public:
QCString &operator+=(const char *);
QCString &operator+=(const QCString &);
#ifdef _KWQ_IOSTREAM_
friend ostream &operator<<(ostream &, const QCString &);
#endif
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
......@@ -87,9 +97,11 @@ public:
// operators associated with QCString ==========================================
bool operator==(const char *, const QCString &);
bool operator==(const QCString &, const char *);
bool operator!=(const char *, const QCString &);
bool operator!=(const QCString &, const char *);
bool operator==(const char *s1, const QCString &s2);
bool operator==(const QCString &s1, const char *s2);
bool operator!=(const char *s1, const QCString &s2);
bool operator!=(const QCString &s1, const char *s2);
#endif // _KWQ_COMPLETE_
#endif
......@@ -33,8 +33,14 @@
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned uint;
typedef unsigned long ulong;
typedef char Q_INT8;
typedef short Q_INT16;
typedef int Q_INT32;
typedef unsigned char Q_UINT8;
typedef unsigned short Q_UINT16;
typedef unsigned int Q_UINT32;
typedef Q_INT32 QCOORD;
......@@ -67,4 +73,20 @@ void qWarning(const char *msg, ...);
typedef int XEvent;
#endif
/* FIXME: Let's not worrying about malloc/new failing for now.... */
#define CHECK_PTR(p)
/* Silly hack to avoid "unused parameter" warnings */
#define Q_UNUSED(x) x=x;
/* We don't handle this, it's needed in QT for wacky hacking Win32 DLLs */
#define Q_EXPORT
/* unnecessary for our platform */
#define Q_PACKED
/* Qt const defines */
#define QT_STATIC_CONST static const
#define QT_STATIC_CONST_IMPL const
#endif
......@@ -30,6 +30,12 @@
#include <config.h>
#endif
// _KWQ_COMPLETE_ ==============================================================
#ifdef _KWQ_COMPLETE_
#include <_qarray.h>
#else
#include <KWQDef.h>
// class QArray ================================================================
......@@ -71,4 +77,6 @@ public:
}; // class QArray =============================================================
#endif // _KWQ_COMPLETE_
#endif
......@@ -62,16 +62,47 @@ public:
int manhattanLength() const;
#ifdef _KWQ_COMPLETE_
bool isNull() const;
void setX(int);
void setY(int);
#endif
// operators ---------------------------------------------------------------
QPoint &operator=(const QPoint &);
/* Note: Trolltech seems to want operator= to be a bitwise copy
* QPoint &operator=(const QPoint &);
*/
friend QPoint operator+(const QPoint &, const QPoint &);
friend QPoint operator-(const QPoint &, const QPoint &);
#ifdef _KWQ_COMPLETE_
QPoint &operator+=(const QPoint &);
QPoint &operator-=(const QPoint &);
QPoint &operator*=(int);
QPoint &operator*=(double);
QPoint &operator/=(int);
QPoint &operator/=(double);
friend inline bool operator==(const QPoint &, const QPoint &);
friend inline bool operator!=(const QPoint &, const QPoint &);
friend inline QPoint operator*(const QPoint &, int);
friend inline QPoint operator*(int, const QPoint &);
friend inline QPoint operator*(const QPoint &, double);
friend inline QPoint operator*(double, const QPoint &);
friend inline QPoint operator-(const QPoint &);
friend inline QPoint operator/(const QPoint &, int);
friend inline QPoint operator/(const QPoint &, double);
#endif
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
QCOORD xx;
QCOORD yy;
}; // class QPoint =============================================================
......
......@@ -30,6 +30,12 @@
#include <config.h>
#endif
// _KWQ_COMPLETE_ ==============================================================
#ifdef _KWQ_COMPLETE_
#include <_qstack.h>
#else
// class QStack ================================================================
template<class T> class QStack {
......@@ -60,4 +66,6 @@ public:
}; // class QStack =============================================================
#endif // _KWQ_COMPLETE_
#endif
......@@ -30,7 +30,12 @@
#include <config.h>
#endif
#include <iostream>
#include <KWQDef.h>
#include "qsize.h"
#include "qpoint.h"
// class QRect =================================================================
......@@ -45,8 +50,13 @@ public:
// constructors, copy constructors, and destructors ------------------------
QRect();
QRect(int l, int t, int w, int h);
QRect(int, int, int, int);
QRect(const QRect &);
#ifdef _KWQ_COMPLETE_
QRect(const QPoint &, const QPoint &);
QRect(const QPoint &, const QSize &);
#endif
// add no-op destructor
#ifdef _KWQ_PEDANTIC_
......@@ -73,13 +83,77 @@ public:
QRect intersect(const QRect &) const;
bool intersects(const QRect &) const;
#ifdef _KWQ_COMPLETE_
bool isEmpty() const;
QRect normalize() const;
void setLeft(int);
void setTop(int);
void setRight(int);
void setBottom(int);
void setX(int);
void setY(int);
QPoint topLeft() const;
QPoint bottomRight() const;
QPoint topRight() const;
QPoint bottomLeft() const;
QPoint center() const;
void rect(int *, int *, int *, int *) const;
void coords(int *, int *, int *, int *) const;
void setSize(const QSize &);
void setRect(int, int, int, int);
void setCoords(int, int, int, int);
void moveTopLeft(const QPoint &);
void moveBottomRight(const QPoint &);
void moveTopRight(const QPoint &);
void moveBottomLeft(const QPoint &);
void moveCenter(const QPoint &);
void moveBy(int, int);
bool contains(const QPoint &, bool proper=FALSE) const;
bool contains(int, int, bool proper=FALSE) const;
bool contains(const QRect &, bool proper=FALSE) const;
QRect unite(const QRect &) const;
#endif // _KWQ_COMPLETE_
// operators ---------------------------------------------------------------
QRect &operator=(const QRect &);
/* Note: Trolltech seems to want operator= to be a bitwise copy
* QRect &operator=(const QRect &);
*/
#ifdef _KWQ_COMPLETE_
friend bool operator==(const QRect &, const QRect &);
friend bool operator!=(const QRect &, const QRect &);
QRect operator|(const QRect &) const;
QRect operator&(const QRect &) const;
QRect& operator|=(const QRect &);
QRect& operator&=(const QRect &);
#endif
#ifdef _KWQ_IOSTREAM_
friend ostream &operator<<(ostream &, const QRect &);
#endif
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
QCOORD x1;
QCOORD x2;
QCOORD y1;
QCOORD y2;
}; // class QRect ==============================================================
// operators associated with QRect =============================================
bool operator==(const QRect &, const QRect &);
bool operator!=(const QRect &, const QRect &);
#endif
......@@ -30,6 +30,12 @@
#include <config.h>
#endif
// _KWQ_COMPLETE_ ==============================================================
#ifdef _KWQ_COMPLETE_
#include <_qregexp.h>
#else
#include "qstring.h"
// class QRegExp ===============================================================
......@@ -60,4 +66,6 @@ public:
}; // class QRegExp ============================================================
#endif // _KWQ_COMPLETE_
#endif
......@@ -30,6 +30,10 @@
#include <config.h>
#endif
#include <iostream>
#include <KWQDef.h>
// class QSize =================================================================
class QSize {
......@@ -60,17 +64,51 @@ public:
void setHeight(int);
QSize expandedTo(const QSize &) const;
#ifdef _KWQ_COMPLETE_
bool isNull() const;
bool isEmpty() const;
void transpose();
QSize boundedTo(const QSize &) const;
#endif
// operators ---------------------------------------------------------------
QSize &operator=(const QSize &);
/* Note: Trolltech seems to want operator= to be a bitwise copy
* QSize &operator=(const QSize &);
*/
friend QSize operator+(const QSize &, const QSize &);
friend bool operator==(const QSize &, const QSize &);
friend bool operator!=(const QSize &, const QSize &);
#ifdef _KWQ_COMPLETE_
QSize &operator+=(const QSize &);
QSize &operator-=(const QSize &);
QSize &operator*=(int);
QSize &operator*=(double);
QSize &operator/=(int);
QSize &operator/=(double);
friend QSize operator-(const QSize &, const QSize &);
friend QSize operator*(const QSize &, int);
friend QSize operator*(int, const QSize &);
friend QSize operator*(const QSize &, double);
friend QSize operator*(double, const QSize &);
friend QSize operator/(const QSize &, int);
friend QSize operator/(const QSize &, double);
#endif
friend inline QSize operator+(const QSize &, const QSize &);
friend inline bool operator==(const QSize &, const QSize &);
friend inline bool operator!=(const QSize &, const QSize &);
#ifdef _KWQ_IOSTREAM_
friend ostream &operator<<(ostream &, const QSize &);
#endif
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
QCOORD w;
QCOORD h;
}; // class QSize ==============================================================
#endif
......@@ -30,6 +30,12 @@
#include <config.h>
#endif
// _KWQ_COMPLETE_ ==============================================================
#ifdef _KWQ_COMPLETE_
#include <_qstring.h>
#else
// FIXME: this clever hack may need to be moved into KWQDef.h or elsewhere
#define Fixed MacFixed
#define Rect MacRect
......@@ -288,4 +294,6 @@ private:
}; // class QConstString =======================================================
#endif // _KWQ_COMPLETE_
#endif
......@@ -30,6 +30,12 @@
#include <config.h>
#endif
// _KWQ_COMPLETE_ ==============================================================
#ifdef _KWQ_COMPLETE_
#include <_qstring.h>
#else
#include "qstring.h"
#include "qcstring.h"
......@@ -134,4 +140,6 @@ private:
}; // class QTextCodec =========================================================
#endif // _KWQ_COMPLETE_
#endif
/****************************************************************************
** $Id$
**
** Definition of QArray template/macro class
**
** Created : 930906
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QARRAY_H
#define QARRAY_H
#ifndef QT_H
#include "_qgarray.h"
#endif // QT_H
template<class type> class QArray : public QGArray
{
public:
typedef type* Iterator;
typedef const type* ConstIterator;
typedef type ValueType;
protected:
QArray( int, int ) : QGArray( 0, 0 ) {}
public:
QArray() {}
QArray( int size ) : QGArray(size*sizeof(type)) {}
QArray( const QArray<type> &a ) : QGArray(a) {}
~QArray() {}
QArray<type> &operator=(const QArray<type> &a)
{ return (QArray<type>&)QGArray::assign(a); }
type *data() const { return (type *)QGArray::data(); }
uint nrefs() const { return QGArray::nrefs(); }
uint size() const { return QGArray::size()/sizeof(type); }
uint count() const { return size(); }
bool isEmpty() const { return QGArray::size() == 0; }
bool isNull() const { return QGArray::data() == 0; }
bool resize( uint size ) { return QGArray::resize(size*sizeof(type)); }
bool truncate( uint pos ) { return QGArray::resize(pos*sizeof(type)); }
bool fill( const type &d, int size = -1 )
{ return QGArray::fill((char*)&d,size,sizeof(type) ); }
void detach() { QGArray::detach(); }
QArray<type> copy() const
{ QArray<type> tmp; return tmp.duplicate(*this); }
QArray<type>& assign( const QArray<type>& a )
{ return (QArray<type>&)QGArray::assign(a); }
QArray<type>& assign( const type *a, uint n )
{ return (QArray<type>&)QGArray::assign((char*)a,n*sizeof(type)); }
QArray<type>& duplicate( const QArray<type>& a )
{ return (QArray<type>&)QGArray::duplicate(a); }
QArray<type>& duplicate( const type *a, uint n )
{ return (QArray<type>&)QGArray::duplicate((char*)a,n*sizeof(type)); }
QArray<type>& setRawData( const type *a, uint n )
{ return (QArray<type>&)QGArray::setRawData((char*)a,
n*sizeof(type)); }
void resetRawData( const type *a, uint n )
{ QGArray::resetRawData((char*)a,n*sizeof(type)); }
int find( const type &d, uint i=0 ) const
{ return QGArray::find((char*)&d,i,sizeof(type)); }
int contains( const type &d ) const
{ return QGArray::contains((char*)&d,sizeof(type)); }
void sort() { QGArray::sort(sizeof(type)); }
int bsearch( const type &d ) const
{ return QGArray::bsearch((const char*)&d,sizeof(type)); }
type& operator[]( int i ) const
{ return (type &)(*(type *)QGArray::at(i*sizeof(type))); }
type& at( uint i ) const
{ return (type &)(*(type *)QGArray::at(i*sizeof(type))); }
operator const type*() const { return (const type *)QGArray::data(); }
bool operator==( const QArray<type> &a ) const { return isEqual(a); }
bool operator!=( const QArray<type> &a ) const { return !isEqual(a); }
Iterator begin() { return data(); }
Iterator end() { return data() + size(); }
ConstIterator begin() const { return data(); }
ConstIterator end() const { return data() + size(); }
};
#endif // QARRAY_H
/****************************************************************************
** $Id$
**
** Implementation of base class for all collection classes
**
** Created : 920820
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**