# HG changeset patch # User eldar # Date 1247425083 0 # Node ID 7dd099050621c74337baed12fba9db2b8aa79e95 # Parent 34fe79a9915b6b69b74b9af365abc2877a46ceea initial commit for D2 support diff -r 34fe79a9915b -r 7dd099050621 Makefile --- a/Makefile Sat Jul 11 11:17:44 2009 +0000 +++ b/Makefile Sun Jul 12 18:58:03 2009 +0000 @@ -56,7 +56,7 @@ NAME_PREFIX = qtd endif ifndef $(PACKAGES) -PACKAGES = core gui +PACKAGES = core endif LIB_PREFIX = lib CC_INCLUDE += include $(QTDIR_INC) $(QTDIR_INC)$(SL)Qt $(QTDIR_INC)$(SL)QtCore $(QTDIR_INC)$(SL)QtGui $(QTDIR_INC)$(SL)QtOpenGL $(QTDIR_INC)$(SL)QtSvg @@ -71,6 +71,7 @@ ifndef D_TARGET D_TARGET = d1-tango endif + ifeq ($(D_TARGET), d1-tango) D_VERSION = 1 else @@ -151,7 +152,7 @@ cd generator && qmake && $(MAKE) dgen: make_gen - cd generator && $(GEN) $(GEN_OPT) --d-target=$(D_TARGET) --output-directory=../ qtjambi_masterinclude.h build_gui.txt + cd generator && $(GEN) $(GEN_OPT) --d-target=$(D_TARGET) --output-directory=../ qtjambi_masterinclude.h build_core.txt ## DGenerator ## end mkdir: diff -r 34fe79a9915b -r 7dd099050621 build/core.makefile --- a/build/core.makefile Sat Jul 11 11:17:44 2009 +0000 +++ b/build/core.makefile Sun Jul 12 18:58:03 2009 +0000 @@ -5,7 +5,18 @@ endif ##-------------------------- -QTD_CORE += QGlobal qtd/Str core/Qt qtd/ArrayOpsPrimitive QtDObject $(D_PATH)/Signal +QTD_CORE += QGlobal $(D_PATH)/qtd/Str core/Qt qtd/ArrayOpsPrimitive $(D_PATH)/QtDObject $(D_PATH)/Signal \ +$(D_PATH)/core/QPoint \ +$(D_PATH)/core/QPointF \ +$(D_PATH)/core/QRect \ +$(D_PATH)/core/QRectF \ +$(D_PATH)/core/QSize \ +$(D_PATH)/core/QSizeF \ +$(D_PATH)/core/QLine \ +$(D_PATH)/core/QLineF \ +$(D_PATH)/core/QModelIndex \ +$(D_PATH)/core/QVariant + ##-------------------------- ## Qt Lib name. @@ -34,27 +45,17 @@ QObject \ QTimerEvent \ QTranslator \ - QPoint \ - QPointF \ - QRect \ - QRectF \ QByteArray \ QLocale \ - QSize \ - QSizeF \ QDataStream \ - QLine \ - QLineF \ QMimeData \ QIODevice \ QDateTime \ QDate \ QTime \ - QVariant \ QBitArray \ QRegExp \ QUrl \ - QModelIndex \ QAbstractItemModel \ QAbstractFileEngine \ QFile \ diff -r 34fe79a9915b -r 7dd099050621 build/core.txt --- a/build/core.txt Sat Jul 11 11:17:44 2009 +0000 +++ b/build/core.txt Sun Jul 12 18:58:03 2009 +0000 @@ -6,16 +6,20 @@ qt_core/QRect_shell qt_core/QRectF_shell qt_core/QString_shell qt_core/QVariant_shell qt_core/QModelIndex_shell qt_core/QMetaType_shell) + ## Module specific d files. -set (d_files qtd/Array qtd/Str QtDObject qtd/ArrayOpsPrimitive +set (d_files qtd/Array qtd/ArrayOpsPrimitive + core/QString core/QMetaType) + +set (d_version_files Signal QtDObject qtd/Str core/QPoint core/QPointF core/QSize core/QSizeF core/QLine core/QLineF core/QRect core/QRectF - core/QString core/QVariant - core/QModelIndex core/QMetaType) -set (d_version_files Signal) + core/QVariant core/QModelIndex) + set (d_generated_files core/Qt QGlobal) + ## Classes. set (classes QChildEvent diff -r 34fe79a9915b -r 7dd099050621 cpp/qt_core/QString_shell.cpp --- a/cpp/qt_core/QString_shell.cpp Sat Jul 11 11:17:44 2009 +0000 +++ b/cpp/qt_core/QString_shell.cpp Sun Jul 12 18:58:03 2009 +0000 @@ -17,8 +17,8 @@ extern "C" DLL_PUBLIC void __qtd_QString_operatorAssign (void* __this_nativeId, - char* text, uint text_size) + DArray text) { QString *__qt_this = (QString *) __this_nativeId; - *__qt_this = QString::fromUtf8(text, text_size); + *__qt_this = QString::fromUtf8((const char *)text.ptr, text.length); } diff -r 34fe79a9915b -r 7dd099050621 cpp/qt_core/QVariant_shell.cpp --- a/cpp/qt_core/QVariant_shell.cpp Sat Jul 11 11:17:44 2009 +0000 +++ b/cpp/qt_core/QVariant_shell.cpp Sun Jul 12 18:58:03 2009 +0000 @@ -394,9 +394,9 @@ // QVariant::QVariant(const QString & string) extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_String -(char* string0, uint string0_size) +(DArray string0) { - QString __qt_string0 = QString::fromUtf8(string0, string0_size); + QString __qt_string0 = QString::fromUtf8((const char *)string0.ptr, string0.length); QVariant_QtDShell *__qt_this = new QVariant_QtDShell((const QString& )__qt_string0); return (void *) __qt_this; diff -r 34fe79a9915b -r 7dd099050621 generator/cppimplgenerator.cpp --- a/generator/cppimplgenerator.cpp Sat Jul 11 11:17:44 2009 +0000 +++ b/generator/cppimplgenerator.cpp Sun Jul 12 18:58:03 2009 +0000 @@ -2014,9 +2014,12 @@ } else s << translateType(argument->type(), EnumAsInts, d_export); } - else if (d_type->name() == "QModelIndex") - s << "QModelIndexAccessor"; - else if (te->isStructInD()) + else if (d_type->name() == "QModelIndex") { + if(d_export && dVersion == 2 && d_type->isConstant()) + s << "const(QModelIndexAccessor)"; + else + s << "QModelIndexAccessor"; + } else if (te->isStructInD()) s << te->qualifiedCppName(); else s << "void*"; @@ -3717,8 +3720,12 @@ return "void*"; else if (java_type->typeEntry()->isEnum() && d_export) return "int" + QString(java_type->indirections(), '*'); - else - return d_name + QString(java_type->indirections(), '*'); + else { + if (java_type->isConstant() && dVersion == 2 && d_export) + return "const (" + d_name + ")" + QString(java_type->indirections(), '*'); + else + return d_name + QString(java_type->indirections(), '*'); + } } else { return d_name + QString(java_type->indirections(), '*'); } diff -r 34fe79a9915b -r 7dd099050621 generator/dgenerator.cpp --- a/generator/dgenerator.cpp Sat Jul 11 11:17:44 2009 +0000 +++ b/generator/dgenerator.cpp Sun Jul 12 18:58:03 2009 +0000 @@ -123,6 +123,12 @@ if (context != 0 && d_type != 0 && context->typeEntry()->isGenericClass() && d_type->originalTemplateType() != 0) d_type = d_type->originalTemplateType(); + QString constPrefix, constPostfix; + if (d_type && d_type->isConstant() && dVersion == 2) { + constPrefix = "const("; + constPostfix = ") "; + } + if (!d_type) { s = "void"; } else if (d_type->typeEntry()->qualifiedCppName() == "QChar") { @@ -163,7 +169,7 @@ else if (d_type->typeEntry()->isEnum()) s = "int" + QString(d_type->actualIndirections(), '*'); else - s = d_type->typeEntry()->lookupName() + QString(d_type->actualIndirections(), '*'); + s = constPrefix + d_type->typeEntry()->lookupName() + QString(d_type->actualIndirections(), '*') + constPostfix; } else if (d_type->isContainer()) { const ContainerTypeEntry* c_entry = static_cast(d_type->typeEntry()); Q_ASSERT(c_entry); @@ -203,8 +209,10 @@ type = type->designatedInterface(); if (type->isString()) s = "string"; - else if (type->isObject()){ + else if (type->isObject()) { s = type->name(); + } else if (type->isValue()){ + s = constPrefix + type->lookupName() + constPostfix; } else { s = type->lookupName(); } @@ -755,8 +763,12 @@ s << d_function->marshalledName() << "("; } - if (!d_function->isConstructor() && !d_function->isStatic()) - s << "nativeId"; + if (!d_function->isConstructor() && !d_function->isStatic()) { + if(dVersion == 2 && d_function->isConstant()) + s << "(cast(" << d_function->ownerClass()->name() << ")this).nativeId"; + else + s << "nativeId"; + } if (d_function->isConstructor() && ( d_function->implementingClass()->hasVirtualFunctions() @@ -818,7 +830,10 @@ s << arg_name << " is null ? null : "; } // else if (value type is abstract) then we will get a null pointer exception, which is all right - s << arg_name << ".nativeId"; + if(dVersion == 2 && type->isConstant()) + s << "(cast(" << type->name() << ")" << arg_name << ").nativeId"; + else + s << arg_name << ".nativeId"; } } } @@ -1936,13 +1951,6 @@ s << m_doc_parser->documentation(d_class) << endl << endl; } -/* qtd s << "@QtJambiGeneratedClass" << endl; - - if ((d_class->typeEntry()->typeFlags() & ComplexTypeEntry::Deprecated) != 0) { - s << "@Deprecated" << endl; - } -*/ - // Enums aliases outside of the class - hack if (!d_class->enums().isEmpty()) { QString fileName = QString("%1_enum.d").arg(d_class->name()); @@ -1956,6 +1964,14 @@ s << endl; +/* qtd s << "@QtJambiGeneratedClass" << endl; + + if ((d_class->typeEntry()->typeFlags() & ComplexTypeEntry::Deprecated) != 0) { + s << "@Deprecated" << endl; + } +*/ + + if (d_class->isInterface()) { s << "public interface "; } else { @@ -2828,7 +2844,7 @@ s << INDENT << "auto " << arg_name << "_d_ref = cast(wchar" << QString(type->actualIndirections(), '*') << ") " << arg_name << ";"; else if (type->isTargetLangString()) - s << INDENT << "string " << arg_name << "_d_ref = toString(" + s << INDENT << "string " << arg_name << "_d_ref = toUTF8(" << arg_name << "[0.." << arg_name << "_size]);"; else if (type->typeEntry()->isValue() && type->isNativePointer() && type->typeEntry()->name() == "QString") { s << INDENT << "auto " << arg_name << "_d_qstr = QString(" << arg_name << ", true);" << endl diff -r 34fe79a9915b -r 7dd099050621 generator/typesystem_core-java.java --- a/generator/typesystem_core-java.java Sat Jul 11 11:17:44 2009 +0000 +++ b/generator/typesystem_core-java.java Sun Jul 12 18:58:03 2009 +0000 @@ -137,7 +137,7 @@ protected static QCoreApplication m_instance = null; - this(in string[] args) + this(string[] args) { // if (m_instance != null) // throw new RuntimeException("QCoreApplication can only be initialized once"); diff -r 34fe79a9915b -r 7dd099050621 generator/typesystem_core.xml --- a/generator/typesystem_core.xml Sat Jul 11 11:17:44 2009 +0000 +++ b/generator/typesystem_core.xml Sun Jul 12 18:58:03 2009 +0000 @@ -2197,7 +2197,7 @@ - + diff -r 34fe79a9915b -r 7dd099050621 generator/typesystem_gui-java.java --- a/generator/typesystem_gui-java.java Sat Jul 11 11:17:44 2009 +0000 +++ b/generator/typesystem_gui-java.java Sun Jul 12 18:58:03 2009 +0000 @@ -1079,7 +1079,7 @@ class QApplication___ extends QApplication { - this(in string[] args) + this(string[] args) { // if (m_instance != null) // throw new RuntimeException("QCoreApplication can only be initialized once"); diff -r 34fe79a9915b -r 7dd099050621 mini/test1/build --- a/mini/test1/build Sat Jul 11 11:17:44 2009 +0000 +++ b/mini/test1/build Sun Jul 12 18:58:03 2009 +0000 @@ -1,3 +1,3 @@ #! /bin/bash -dmd main.d -L-L../../lib -L-lqtdcore -I../../ -I../../qt/d1 -L-lQtCore \ No newline at end of file +dmd main.d -L-L../../lib -L-lqtdcore -I../../ -I../../qt/d2 -L-lQtCore \ No newline at end of file diff -r 34fe79a9915b -r 7dd099050621 mini/test1/main.d --- a/mini/test1/main.d Sat Jul 11 11:17:44 2009 +0000 +++ b/mini/test1/main.d Sun Jul 12 18:58:03 2009 +0000 @@ -1,6 +1,6 @@ import qt.core.QCoreApplication; -import tango.io.Stdout; +version(Tango) {} else { import std.stdio; } int main(string[] args) { @@ -16,13 +16,14 @@ child3.setObjectName("child3"); auto cd = parent.children; - - Stdout(app.arguments).newline; + + writeln(app.arguments); foreach(child; cd) - Stdout(child.objectName).newline; + writeln(child.objectName); app.setLibraryPaths(["freakin", "bloody", "awesome!"]); - Stdout(app.libraryPaths).newline; + + writeln(app.libraryPaths); return 5; // return app.exec(); diff -r 34fe79a9915b -r 7dd099050621 qt/QGlobal.d --- a/qt/QGlobal.d Sat Jul 11 11:17:44 2009 +0000 +++ b/qt/QGlobal.d Sun Jul 12 18:58:03 2009 +0000 @@ -9,9 +9,15 @@ { Stdout(s).newline; } + package import tango.stdc.stdlib, + tango.core.Memory; } else +{ import std.stdio; + package import std.c.stdlib, + core.memory; +} template QT_BEGIN_NAMESPACE() { } @@ -586,9 +592,6 @@ mixin QT_END_NAMESPACE; -package import tango.stdc.stdlib, - tango.core.Memory; - private struct Align { @@ -599,11 +602,6 @@ private const PTR_ALIGN = Align.tupleof[1].alignof; -version( X86 ) - const MEM_ALIGN = 8u; -else - static assert(false, "Unknown memory alignment for this platform."); - private template AlignPad(size_t base, size_t aligned) { @@ -672,22 +670,6 @@ const Max = b; } -template InstanceSizeAligned(T, size_t alignment=MEM_ALIGN) -{ - static if( alignment == 0 ) - const InstanceSizeAligned = InstanceSize!(T); - else - const uint InstanceSizeAligned - = InstanceSizeAlignImpl!(T, alignment).result; -} - -private -template InstanceSizeAlignedImpl(T, size_t alignment) -{ - private const base_size = InstanceSize!(T); - const result = ((base_size+alignment-1)/alignment)*alignment; -} - private template InterfaceCount(T) { diff -r 34fe79a9915b -r 7dd099050621 qt/QGlobal.d.inc --- a/qt/QGlobal.d.inc Sat Jul 11 11:17:44 2009 +0000 +++ b/qt/QGlobal.d.inc Sun Jul 12 18:58:03 2009 +0000 @@ -9,9 +9,15 @@ { Stdout(s).newline; } + package import tango.stdc.stdlib, + tango.core.Memory; } else +{ import std.stdio; + package import std.c.stdlib, + core.memory; +} template QT_BEGIN_NAMESPACE() { } diff -r 34fe79a9915b -r 7dd099050621 qt/QtDObject.d --- a/qt/QtDObject.d Sat Jul 11 11:17:44 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/** -* -* Copyright: Copyright QtD Team, 2008-2009 -* License: 0); - return qtd_QVariant_canConvert(nativeId, i); - } - - public final bool canConvert(Type)() { - static if ( is(Type == QBitArray) ) - return canConvertImpl("QBitArray"); - else static if ( is(Type == bool) ) - return canConvertImpl("bool"); - else static if ( is(Type == QByteArray) ) - return canConvertImpl("QByteArray"); - else static if ( is(Type == QDate) ) - return canConvertImpl("QDate"); - else static if ( is(Type == QDateTime) ) - return canConvertImpl("QDateTime"); - else static if ( is(Type == double) ) - return canConvertImpl("double"); - else static if ( is(Type == int) ) - return canConvertImpl("int"); - else static if ( is(Type == QLine) ) - return canConvertImpl("QLine"); - else static if ( is(Type == QLineF) ) - return canConvertImpl("QLineF"); - else static if ( is(Type == QLocale) ) - return canConvertImpl("QLocale"); - else static if ( is(Type == long) ) - return canConvertImpl("long"); - else static if ( is(Type == QPoint) ) - return canConvertImpl("QPoint"); - else static if ( is(Type == QPointF) ) - return canConvertImpl("QPointF"); - else static if ( is(Type == QRect) ) - return canConvertImpl("QRect"); - else static if ( is(Type == QRectF) ) - return canConvertImpl("QRectF"); - else static if ( is(Type == QRegExp) ) - return canConvertImpl("QRegExp"); - else static if ( is(Type == QSize) ) - return canConvertImpl("QSize"); - else static if ( is(Type == QSizeF) ) - return canConvertImpl("QSizeF"); - else static if ( is(Type == string) ) - return canConvertImpl("QString"); - else static if ( is(Type == QTime) ) - return canConvertImpl("QTime"); - else static if ( is(Type == uint) ) - return canConvertImpl("unsigned int"); // TODO: - else static if ( is(Type == ulong) ) - return canConvertImpl("unsigned long long"); // TODO: - else static if ( is(Type == QUrl) ) - return canConvertImpl("QUrl"); - else - { - static if( is( Type == class ) || is( Type == interface ) ) - { - Object object = cast(Object)qtd_QVariant_data(nativeId); - if(object) - return cast(Type)(object) !is null; - return false; - } - else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) - { - auto array = cast(DArrayToC*)qtd_QVariant_data(nativeId); - return cast(Type)(array.array) !is null; - } - else - { - int i = qtd_MetatypeId(toStringz(typeid(Type).toString)); - return qtd_QVariant_canConvert(nativeId, i); - } - } - } - - public final Type value(Type)() { - static if ( is(Type == QBitArray) ) - return toBitArra; - else static if ( is(Type == bool) ) - return toBool; - else static if ( is(Type == QByteArray) ) - return toByteArray; - else static if ( is(Type == QDate) ) - return toDate; - else static if ( is(Type == QDateTime) ) - return toDateTime; - else static if ( is(Type == double) ) - return toDouble; - else static if ( is(Type == int) ) - return toInt; - else static if ( is(Type == QLine) ) - return toLine; - else static if ( is(Type == QLineF) ) - return toLineF; - else static if ( is(Type == QLocale) ) - return toLocale; - else static if ( is(Type == long) ) - return toLongLong; - else static if ( is(Type == QPoint) ) - return toPoint; - else static if ( is(Type == QPointF) ) - return toPointF; - else static if ( is(Type == QRect) ) - return toRect; - else static if ( is(Type == QRectF) ) - return toRectF; - else static if ( is(Type == QRegExp) ) - return toRegExp; - else static if ( is(Type == QSize) ) - return toSize; - else static if ( is(Type == QSizeF) ) - return toSizeF; - else static if ( is(Type == string) ) - return toString; - else static if ( is(Type == QTime) ) - return toTime; - else static if ( is(Type == uint) ) - return toUInt; - else static if ( is(Type == ulong) ) - return toULongLong; - else static if ( is(Type == QUrl) ) - return toUrl; - else static if( is( Type == class ) || is( Type == interface ) ) - { - Object object = cast(Object)qtd_QVariant_data(nativeId); - if(object) - return cast(Type)(object); - return null; - } - else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) - { - auto array = cast(DArrayToC*)qtd_QVariant_data(nativeId); - return cast(Type)(array.array); - } - else - { - return *cast(Type*)qtd_QVariant_data(nativeId); - } - } - - public final void clear() { - qtd_QVariant_clear(nativeId); - } - - protected final bool cmp(QVariant other) { - return qtd_QVariant_cmp_QVariant(nativeId, other is null ? null : other.nativeId); - } - - protected final void create(int type, void* copy) { - qtd_QVariant_create_int_nativepointervoid(nativeId, type, copy); - } - - public final bool isNull() { - return qtd_QVariant_isNull(nativeId); - } - - public final bool isValid() { - return qtd_QVariant_isValid(nativeId); - } - - public final void load(QDataStream ds) { - qtd_QVariant_load_QDataStream(nativeId, ds is null ? null : ds.nativeId); - } - - public final void writeTo(QDataStream s) { - qtd_QVariant_writeTo_QDataStream(nativeId, s is null ? null : s.nativeId); - } - - public final QVariant operator_assign(QVariant other) { - void* __qt_return_value = qtd_QVariant_operator_assign_QVariant(nativeId, other is null ? null : other.nativeId); - return new QVariant(__qt_return_value, true); - } - - private final bool operator_equal(QVariant v) { - return qtd_QVariant_operator_equal_QVariant(nativeId, v is null ? null : v.nativeId); - } - - public final void readFrom(QDataStream s) { - qtd_QVariant_readFrom_QDataStream(nativeId, s is null ? null : s.nativeId); - } - - public final void save(QDataStream ds) { - qtd_QVariant_save_QDataStream(nativeId, ds is null ? null : ds.nativeId); - } - - public final QBitArray toBitArray() { - void* __qt_return_value = qtd_QVariant_toBitArray(nativeId); - return new QBitArray(__qt_return_value, false); - } - - public final bool toBool() { - return qtd_QVariant_toBool(nativeId); - } - - public final QByteArray toByteArray() { - void* __qt_return_value = qtd_QVariant_toByteArray(nativeId); - return new QByteArray(__qt_return_value, false); - } - - public final QDate toDate() { - void* __qt_return_value = qtd_QVariant_toDate(nativeId); - return new QDate(__qt_return_value, false); - } - - public final QDateTime toDateTime() { - void* __qt_return_value = qtd_QVariant_toDateTime(nativeId); - return new QDateTime(__qt_return_value, false); - } - - public final double toDouble(bool* ok = null) { - return qtd_QVariant_toDouble_nativepointerbool(nativeId, ok); - } - - public final int toInt(bool* ok = null) { - return qtd_QVariant_toInt_nativepointerbool(nativeId, ok); - } - - public final QLine toLine() { - return qtd_QVariant_toLine(nativeId); - } - - public final QLineF toLineF() { - return qtd_QVariant_toLineF(nativeId); - } - - public final QLocale toLocale() { - void* __qt_return_value = qtd_QVariant_toLocale(nativeId); - return new QLocale(__qt_return_value, false); - } - - public final long toLongLong(bool* ok = null) { - return qtd_QVariant_toLongLong_nativepointerbool(nativeId, ok); - } - - public final QPoint toPoint() { - return qtd_QVariant_toPoint(nativeId); - } - - public final QPointF toPointF() { - return qtd_QVariant_toPointF(nativeId); - } - - public final QRect toRect() { - return qtd_QVariant_toRect(nativeId); - } - - public final QRectF toRectF() { - return qtd_QVariant_toRectF(nativeId); - } - - public final QRegExp toRegExp() { - void* __qt_return_value = qtd_QVariant_toRegExp(nativeId); - return new QRegExp(__qt_return_value, false); - } - - public final QSize toSize() { - return qtd_QVariant_toSize(nativeId); - } - - public final QSizeF toSizeF() { - return qtd_QVariant_toSizeF(nativeId); - } - - public final string toString() { - string res; - qtd_QVariant_toString(nativeId, &res); - return res; - } - - public final QTime toTime() { - void* __qt_return_value = qtd_QVariant_toTime(nativeId); - return new QTime(__qt_return_value, false); - } - - public final uint toUInt(bool* ok = null) { - return qtd_QVariant_toUInt_nativepointerbool(nativeId, ok); - } - - public final ulong toULongLong(bool* ok = null) { - return qtd_QVariant_toULongLong_nativepointerbool(nativeId, ok); - } - - public final QUrl toUrl() { - void* __qt_return_value = qtd_QVariant_toUrl(nativeId); - return new QUrl(__qt_return_value, false); - } - - public final char* typeName() { - return qtd_QVariant_typeName(nativeId); - } - - public final Type type() { - return cast(Type)qtd_QVariant_type(nativeId); - } - - public final int userType() { - return qtd_QVariant_userType(nativeId); - } -// Field accessors - - public this(void* native_id, bool no_real_delete = false) { - super(native_id, no_real_delete); - } - - - ~this() { - if(!__no_real_delete) - __free_native_resources(); - } - - protected void __free_native_resources() { - qtd_QVariant_destructor(nativeId()); - } - -// Injected code in class -} -extern (C) void qtd_QVariant_destructor(void *ptr); - - -// C wrappers -private extern(C) void* qtd_QVariant_QVariant(); -private extern(C) void* qtd_QVariant_QVariant_QDataStream(void* s0); -private extern(C) void* qtd_QVariant_QVariant_GlobalColor(int color0); -private extern(C) void* qtd_QVariant_QVariant_bool(bool b0); -private extern(C) void* qtd_QVariant_QVariant_QBitArray(void* bitarray0); -private extern(C) void* qtd_QVariant_QVariant_QByteArray(void* bytearray0); -private extern(C) void* qtd_QVariant_QVariant_QDate(void* date0); -private extern(C) void* qtd_QVariant_QVariant_QDateTime(void* datetime0); -private extern(C) void* qtd_QVariant_QVariant_String(char* string0, uint string0_size); -private extern(C) void* qtd_QVariant_QVariant_QLine(void* line0); -private extern(C) void* qtd_QVariant_QVariant_QLineF(void* line0); -private extern(C) void* qtd_QVariant_QVariant_QLocale(void* locale0); -private extern(C) void* qtd_QVariant_QVariant_QPoint(void* pt0); -private extern(C) void* qtd_QVariant_QVariant_QPointF(void* pt0); -private extern(C) void* qtd_QVariant_QVariant_QRect(void* rect0); -private extern(C) void* qtd_QVariant_QVariant_QRectF(void* rect0); -private extern(C) void* qtd_QVariant_QVariant_QRegExp(void* regExp0); -private extern(C) void* qtd_QVariant_QVariant_QSize(void* size0); -private extern(C) void* qtd_QVariant_QVariant_QSizeF(void* size0); -private extern(C) void* qtd_QVariant_QVariant_QTime(void* time0); -private extern(C) void* qtd_QVariant_QVariant_QUrl(void* url0); -private extern(C) void* qtd_QVariant_QVariant_QVariant(void* other0); -private extern(C) void* qtd_QVariant_QVariant_nativepointerchar(char* str0); -private extern(C) void* qtd_QVariant_QVariant_double(double d0); -private extern(C) void* qtd_QVariant_QVariant_int(int i0); -private extern(C) void* qtd_QVariant_QVariant_int_nativepointervoid(int typeOrUserType0, - void* copy1); -private extern(C) void* qtd_QVariant_QVariant_long(long ll0); -private extern(C) void* qtd_QVariant_QVariant_uint(uint ui0); -private extern(C) void* qtd_QVariant_QVariant_ulong(ulong ull0); -private extern(C) bool qtd_QVariant_canConvert(void* __this_nativeId, int); -private extern(C) void qtd_QVariant_clear(void* __this_nativeId); -private extern(C) bool qtd_QVariant_cmp_QVariant(void* __this_nativeId, - void* other0); -private extern(C) void qtd_QVariant_create_int_nativepointervoid(void* __this_nativeId, - int type0, - void* copy1); -private extern(C) bool qtd_QVariant_isNull(void* __this_nativeId); -private extern(C) bool qtd_QVariant_isValid(void* __this_nativeId); -private extern(C) void qtd_QVariant_load_QDataStream(void* __this_nativeId, - void* ds0); -private extern(C) void qtd_QVariant_writeTo_QDataStream(void* __this_nativeId, - void* s0); -private extern(C) void* qtd_QVariant_operator_assign_QVariant(void* __this_nativeId, - void* other0); -private extern(C) bool qtd_QVariant_operator_equal_QVariant(void* __this_nativeId, - void* v0); -private extern(C) void qtd_QVariant_readFrom_QDataStream(void* __this_nativeId, - void* s0); -private extern(C) void qtd_QVariant_save_QDataStream(void* __this_nativeId, - void* ds0); -private extern(C) void* qtd_QVariant_toBitArray(void* __this_nativeId); -private extern(C) bool qtd_QVariant_toBool(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toByteArray(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toDate(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toDateTime(void* __this_nativeId); -private extern(C) double qtd_QVariant_toDouble_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) int qtd_QVariant_toInt_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) QLine qtd_QVariant_toLine(void* __this_nativeId); -private extern(C) QLineF qtd_QVariant_toLineF(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toLocale(void* __this_nativeId); -private extern(C) long qtd_QVariant_toLongLong_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) QPoint qtd_QVariant_toPoint(void* __this_nativeId); -private extern(C) QPointF qtd_QVariant_toPointF(void* __this_nativeId); -private extern(C) QRect qtd_QVariant_toRect(void* __this_nativeId); -private extern(C) QRectF qtd_QVariant_toRectF(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toRegExp(void* __this_nativeId); -private extern(C) QSize qtd_QVariant_toSize(void* __this_nativeId); -private extern(C) QSizeF qtd_QVariant_toSizeF(void* __this_nativeId); -private extern(C) void qtd_QVariant_toString(void* __this_nativeId, - void* __java_return_value); -private extern(C) void* qtd_QVariant_toTime(void* __this_nativeId); -private extern(C) uint qtd_QVariant_toUInt_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) ulong qtd_QVariant_toULongLong_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) void* qtd_QVariant_toUrl(void* __this_nativeId); -private extern(C) char* qtd_QVariant_typeName(void* __this_nativeId); -private extern(C) int qtd_QVariant_type(void* __this_nativeId); -private extern(C) int qtd_QVariant_userType(void* __this_nativeId); -private extern(C) void *qtd_QVariant_data(void* __this_nativeId); - -// Just the private functions for abstract functions implemeneted in superclasses - -// Virtual Dispatch functions diff -r 34fe79a9915b -r 7dd099050621 qt/d1/qt/QtDObject.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d1/qt/QtDObject.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,70 @@ +/** +* +* Copyright: Copyright QtD Team, 2008-2009 +* License: 0); + return qtd_QVariant_canConvert(nativeId, i); + } + + public final bool canConvert(Type)() { + static if ( is(Type == QBitArray) ) + return canConvertImpl("QBitArray"); + else static if ( is(Type == bool) ) + return canConvertImpl("bool"); + else static if ( is(Type == QByteArray) ) + return canConvertImpl("QByteArray"); + else static if ( is(Type == QDate) ) + return canConvertImpl("QDate"); + else static if ( is(Type == QDateTime) ) + return canConvertImpl("QDateTime"); + else static if ( is(Type == double) ) + return canConvertImpl("double"); + else static if ( is(Type == int) ) + return canConvertImpl("int"); + else static if ( is(Type == QLine) ) + return canConvertImpl("QLine"); + else static if ( is(Type == QLineF) ) + return canConvertImpl("QLineF"); + else static if ( is(Type == QLocale) ) + return canConvertImpl("QLocale"); + else static if ( is(Type == long) ) + return canConvertImpl("long"); + else static if ( is(Type == QPoint) ) + return canConvertImpl("QPoint"); + else static if ( is(Type == QPointF) ) + return canConvertImpl("QPointF"); + else static if ( is(Type == QRect) ) + return canConvertImpl("QRect"); + else static if ( is(Type == QRectF) ) + return canConvertImpl("QRectF"); + else static if ( is(Type == QRegExp) ) + return canConvertImpl("QRegExp"); + else static if ( is(Type == QSize) ) + return canConvertImpl("QSize"); + else static if ( is(Type == QSizeF) ) + return canConvertImpl("QSizeF"); + else static if ( is(Type == string) ) + return canConvertImpl("QString"); + else static if ( is(Type == QTime) ) + return canConvertImpl("QTime"); + else static if ( is(Type == uint) ) + return canConvertImpl("unsigned int"); // TODO: + else static if ( is(Type == ulong) ) + return canConvertImpl("unsigned long long"); // TODO: + else static if ( is(Type == QUrl) ) + return canConvertImpl("QUrl"); + else + { + static if( is( Type == class ) || is( Type == interface ) ) + { + Object object = cast(Object)qtd_QVariant_data(nativeId); + if(object) + return cast(Type)(object) !is null; + return false; + } + else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) + { + auto array = cast(DArrayToC*)qtd_QVariant_data(nativeId); + return cast(Type)(array.array) !is null; + } + else + { + int i = qtd_MetatypeId(toStringz(typeid(Type).toString)); + return qtd_QVariant_canConvert(nativeId, i); + } + } + } + + public final Type value(Type)() { + static if ( is(Type == QBitArray) ) + return toBitArra; + else static if ( is(Type == bool) ) + return toBool; + else static if ( is(Type == QByteArray) ) + return toByteArray; + else static if ( is(Type == QDate) ) + return toDate; + else static if ( is(Type == QDateTime) ) + return toDateTime; + else static if ( is(Type == double) ) + return toDouble; + else static if ( is(Type == int) ) + return toInt; + else static if ( is(Type == QLine) ) + return toLine; + else static if ( is(Type == QLineF) ) + return toLineF; + else static if ( is(Type == QLocale) ) + return toLocale; + else static if ( is(Type == long) ) + return toLongLong; + else static if ( is(Type == QPoint) ) + return toPoint; + else static if ( is(Type == QPointF) ) + return toPointF; + else static if ( is(Type == QRect) ) + return toRect; + else static if ( is(Type == QRectF) ) + return toRectF; + else static if ( is(Type == QRegExp) ) + return toRegExp; + else static if ( is(Type == QSize) ) + return toSize; + else static if ( is(Type == QSizeF) ) + return toSizeF; + else static if ( is(Type == string) ) + return toString; + else static if ( is(Type == QTime) ) + return toTime; + else static if ( is(Type == uint) ) + return toUInt; + else static if ( is(Type == ulong) ) + return toULongLong; + else static if ( is(Type == QUrl) ) + return toUrl; + else static if( is( Type == class ) || is( Type == interface ) ) + { + Object object = cast(Object)qtd_QVariant_data(nativeId); + if(object) + return cast(Type)(object); + return null; + } + else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) + { + auto array = cast(DArrayToC*)qtd_QVariant_data(nativeId); + return cast(Type)(array.array); + } + else + { + return *cast(Type*)qtd_QVariant_data(nativeId); + } + } + + public final void clear() { + qtd_QVariant_clear(nativeId); + } + + protected final bool cmp(QVariant other) { + return qtd_QVariant_cmp_QVariant(nativeId, other is null ? null : other.nativeId); + } + + protected final void create(int type, void* copy) { + qtd_QVariant_create_int_nativepointervoid(nativeId, type, copy); + } + + public final bool isNull() { + return qtd_QVariant_isNull(nativeId); + } + + public final bool isValid() { + return qtd_QVariant_isValid(nativeId); + } + + public final void load(QDataStream ds) { + qtd_QVariant_load_QDataStream(nativeId, ds is null ? null : ds.nativeId); + } + + public final void writeTo(QDataStream s) { + qtd_QVariant_writeTo_QDataStream(nativeId, s is null ? null : s.nativeId); + } + + public final QVariant operator_assign(QVariant other) { + void* __qt_return_value = qtd_QVariant_operator_assign_QVariant(nativeId, other is null ? null : other.nativeId); + return new QVariant(__qt_return_value, true); + } + + private final bool operator_equal(QVariant v) { + return qtd_QVariant_operator_equal_QVariant(nativeId, v is null ? null : v.nativeId); + } + + public final void readFrom(QDataStream s) { + qtd_QVariant_readFrom_QDataStream(nativeId, s is null ? null : s.nativeId); + } + + public final void save(QDataStream ds) { + qtd_QVariant_save_QDataStream(nativeId, ds is null ? null : ds.nativeId); + } + + public final QBitArray toBitArray() { + void* __qt_return_value = qtd_QVariant_toBitArray(nativeId); + return new QBitArray(__qt_return_value, false); + } + + public final bool toBool() { + return qtd_QVariant_toBool(nativeId); + } + + public final QByteArray toByteArray() { + void* __qt_return_value = qtd_QVariant_toByteArray(nativeId); + return new QByteArray(__qt_return_value, false); + } + + public final QDate toDate() { + void* __qt_return_value = qtd_QVariant_toDate(nativeId); + return new QDate(__qt_return_value, false); + } + + public final QDateTime toDateTime() { + void* __qt_return_value = qtd_QVariant_toDateTime(nativeId); + return new QDateTime(__qt_return_value, false); + } + + public final double toDouble(bool* ok = null) { + return qtd_QVariant_toDouble_nativepointerbool(nativeId, ok); + } + + public final int toInt(bool* ok = null) { + return qtd_QVariant_toInt_nativepointerbool(nativeId, ok); + } + + public final QLine toLine() { + return qtd_QVariant_toLine(nativeId); + } + + public final QLineF toLineF() { + return qtd_QVariant_toLineF(nativeId); + } + + public final QLocale toLocale() { + void* __qt_return_value = qtd_QVariant_toLocale(nativeId); + return new QLocale(__qt_return_value, false); + } + + public final long toLongLong(bool* ok = null) { + return qtd_QVariant_toLongLong_nativepointerbool(nativeId, ok); + } + + public final QPoint toPoint() { + return qtd_QVariant_toPoint(nativeId); + } + + public final QPointF toPointF() { + return qtd_QVariant_toPointF(nativeId); + } + + public final QRect toRect() { + return qtd_QVariant_toRect(nativeId); + } + + public final QRectF toRectF() { + return qtd_QVariant_toRectF(nativeId); + } + + public final QRegExp toRegExp() { + void* __qt_return_value = qtd_QVariant_toRegExp(nativeId); + return new QRegExp(__qt_return_value, false); + } + + public final QSize toSize() { + return qtd_QVariant_toSize(nativeId); + } + + public final QSizeF toSizeF() { + return qtd_QVariant_toSizeF(nativeId); + } + + public final string toString() { + string res; + qtd_QVariant_toString(nativeId, &res); + return res; + } + + public final QTime toTime() { + void* __qt_return_value = qtd_QVariant_toTime(nativeId); + return new QTime(__qt_return_value, false); + } + + public final uint toUInt(bool* ok = null) { + return qtd_QVariant_toUInt_nativepointerbool(nativeId, ok); + } + + public final ulong toULongLong(bool* ok = null) { + return qtd_QVariant_toULongLong_nativepointerbool(nativeId, ok); + } + + public final QUrl toUrl() { + void* __qt_return_value = qtd_QVariant_toUrl(nativeId); + return new QUrl(__qt_return_value, false); + } + + public final char* typeName() { + return qtd_QVariant_typeName(nativeId); + } + + public final Type type() { + return cast(Type)qtd_QVariant_type(nativeId); + } + + public final int userType() { + return qtd_QVariant_userType(nativeId); + } +// Field accessors + + public this(void* native_id, bool no_real_delete = false) { + super(native_id, no_real_delete); + } + + + ~this() { + if(!__no_real_delete) + __free_native_resources(); + } + + protected void __free_native_resources() { + qtd_QVariant_destructor(nativeId()); + } + +// Injected code in class +} +extern (C) void qtd_QVariant_destructor(void *ptr); + + +// C wrappers +private extern(C) void* qtd_QVariant_QVariant(); +private extern(C) void* qtd_QVariant_QVariant_QDataStream(void* s0); +private extern(C) void* qtd_QVariant_QVariant_GlobalColor(int color0); +private extern(C) void* qtd_QVariant_QVariant_bool(bool b0); +private extern(C) void* qtd_QVariant_QVariant_QBitArray(void* bitarray0); +private extern(C) void* qtd_QVariant_QVariant_QByteArray(void* bytearray0); +private extern(C) void* qtd_QVariant_QVariant_QDate(void* date0); +private extern(C) void* qtd_QVariant_QVariant_QDateTime(void* datetime0); +private extern(C) void* qtd_QVariant_QVariant_String(string string0); +private extern(C) void* qtd_QVariant_QVariant_QLine(void* line0); +private extern(C) void* qtd_QVariant_QVariant_QLineF(void* line0); +private extern(C) void* qtd_QVariant_QVariant_QLocale(void* locale0); +private extern(C) void* qtd_QVariant_QVariant_QPoint(void* pt0); +private extern(C) void* qtd_QVariant_QVariant_QPointF(void* pt0); +private extern(C) void* qtd_QVariant_QVariant_QRect(void* rect0); +private extern(C) void* qtd_QVariant_QVariant_QRectF(void* rect0); +private extern(C) void* qtd_QVariant_QVariant_QRegExp(void* regExp0); +private extern(C) void* qtd_QVariant_QVariant_QSize(void* size0); +private extern(C) void* qtd_QVariant_QVariant_QSizeF(void* size0); +private extern(C) void* qtd_QVariant_QVariant_QTime(void* time0); +private extern(C) void* qtd_QVariant_QVariant_QUrl(void* url0); +private extern(C) void* qtd_QVariant_QVariant_QVariant(void* other0); +private extern(C) void* qtd_QVariant_QVariant_nativepointerchar(char* str0); +private extern(C) void* qtd_QVariant_QVariant_double(double d0); +private extern(C) void* qtd_QVariant_QVariant_int(int i0); +private extern(C) void* qtd_QVariant_QVariant_int_nativepointervoid(int typeOrUserType0, + void* copy1); +private extern(C) void* qtd_QVariant_QVariant_long(long ll0); +private extern(C) void* qtd_QVariant_QVariant_uint(uint ui0); +private extern(C) void* qtd_QVariant_QVariant_ulong(ulong ull0); +private extern(C) bool qtd_QVariant_canConvert(void* __this_nativeId, int); +private extern(C) void qtd_QVariant_clear(void* __this_nativeId); +private extern(C) bool qtd_QVariant_cmp_QVariant(void* __this_nativeId, + void* other0); +private extern(C) void qtd_QVariant_create_int_nativepointervoid(void* __this_nativeId, + int type0, + void* copy1); +private extern(C) bool qtd_QVariant_isNull(void* __this_nativeId); +private extern(C) bool qtd_QVariant_isValid(void* __this_nativeId); +private extern(C) void qtd_QVariant_load_QDataStream(void* __this_nativeId, + void* ds0); +private extern(C) void qtd_QVariant_writeTo_QDataStream(void* __this_nativeId, + void* s0); +private extern(C) void* qtd_QVariant_operator_assign_QVariant(void* __this_nativeId, + void* other0); +private extern(C) bool qtd_QVariant_operator_equal_QVariant(void* __this_nativeId, + void* v0); +private extern(C) void qtd_QVariant_readFrom_QDataStream(void* __this_nativeId, + void* s0); +private extern(C) void qtd_QVariant_save_QDataStream(void* __this_nativeId, + void* ds0); +private extern(C) void* qtd_QVariant_toBitArray(void* __this_nativeId); +private extern(C) bool qtd_QVariant_toBool(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toByteArray(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toDate(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toDateTime(void* __this_nativeId); +private extern(C) double qtd_QVariant_toDouble_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) int qtd_QVariant_toInt_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) QLine qtd_QVariant_toLine(void* __this_nativeId); +private extern(C) QLineF qtd_QVariant_toLineF(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toLocale(void* __this_nativeId); +private extern(C) long qtd_QVariant_toLongLong_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) QPoint qtd_QVariant_toPoint(void* __this_nativeId); +private extern(C) QPointF qtd_QVariant_toPointF(void* __this_nativeId); +private extern(C) QRect qtd_QVariant_toRect(void* __this_nativeId); +private extern(C) QRectF qtd_QVariant_toRectF(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toRegExp(void* __this_nativeId); +private extern(C) QSize qtd_QVariant_toSize(void* __this_nativeId); +private extern(C) QSizeF qtd_QVariant_toSizeF(void* __this_nativeId); +private extern(C) void qtd_QVariant_toString(void* __this_nativeId, + void* __java_return_value); +private extern(C) void* qtd_QVariant_toTime(void* __this_nativeId); +private extern(C) uint qtd_QVariant_toUInt_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) ulong qtd_QVariant_toULongLong_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) void* qtd_QVariant_toUrl(void* __this_nativeId); +private extern(C) char* qtd_QVariant_typeName(void* __this_nativeId); +private extern(C) int qtd_QVariant_type(void* __this_nativeId); +private extern(C) int qtd_QVariant_userType(void* __this_nativeId); +private extern(C) void *qtd_QVariant_data(void* __this_nativeId); + +// Just the private functions for abstract functions implemeneted in superclasses + +// Virtual Dispatch functions diff -r 34fe79a9915b -r 7dd099050621 qt/d1/qt/qtd/Str.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d1/qt/qtd/Str.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,56 @@ +/** + * + * Copyright: Copyright QtD Team, 2008-2009 + * License: Boost License 1.0 +* +* Copyright QtD Team, 2008-2009 +* Distributed under the Boost Software License, Version 1.0. +* (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +* +*/ + +module qt.QtDObject; + +//import tango.util.container.HashMap; +import qt.Signal; + +package class QtDObject +{ +// public final const(void*) nativeId() const { return native__id; } + public final void* nativeId() { return native__id; } + + public final void nativeId(void *native_id) { native__id = native_id; } + + private void* native__id = null; + + mixin SignalHandlerOps; + + public this() + { + /* intentionally empty */ + } + + package this(void* native_id, bool no_real_delete = false) + { + native__id = native_id; +/* auto qObj = cast(QObject) this; + if (qObj is null) + register(native__id);*/ + __no_real_delete = no_real_delete; + } +/* + ~this() { + unregister(native__id); + } +*/ + // this flag controls if D object when destroying should or shouldn't delete real C++ object + public bool __no_real_delete = false; + + package void __free_native_resources(); + + + /* hash table of Object instances */ +/* private static HashMap!(void*, Object) _map; + + static this() { + _map = new HashMap!(void*, Object); + } + + package static void register(void* qt_object, Object d_object) { + _map.add(qt_object, d_object); + } + + package static void unregister(void* qt_object) { + _map.removeKey(qt_object); + } + + package static Object lookup(void* qt_object) { + return _map[qt_object]; + } + */ +} \ No newline at end of file diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/Signal.d --- a/qt/d2/qt/Signal.d Sat Jul 11 11:17:44 2009 +0000 +++ b/qt/d2/qt/Signal.d Sun Jul 12 18:58:03 2009 +0000 @@ -17,7 +17,8 @@ import core.stdc.string : memmove; import std.traits, - core.thread; + core.thread, + core.exception; @@ -35,7 +36,7 @@ { a = (cast(T*)crealloc(a.ptr, length * T.sizeof))[0..length]; if (!a.ptr) - new OutOfMemoryException(__FILE__, __LINE__); + new OutOfMemoryError(__FILE__, __LINE__); } unittest diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QLine.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QLine.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,390 @@ +module qt.core.QLine; + +public import qt.QGlobal; +public import qt.core.Qt; +public import qt.core.QPoint; +public import qt.core.QDataStream; + + +public struct QLine +{ + public static QLine opCall() { + QLine ln; + ln.pt1 = QPoint(); + ln.pt2 = QPoint(); + return ln; + } + + public this(QPoint pt1_, QPoint pt2_) { + pt1 = pt1_; + pt2 = pt2_; + } + + public this(int x1pos, int y1pos, int x2pos, int y2pos) { + pt1 = QPoint(x1pos, y1pos); + pt2 = QPoint(x2pos, y2pos); + } + + bool isNull() // const + { + return pt1 == pt2; + } + + int x1() // const + { + return pt1.x(); + } + + int y1() // const + { + return pt1.y(); + } + + int x2() // const + { + return pt2.x(); + } + + int y2() // const + { + return pt2.y(); + } + + QPoint p1() // const + { + return pt1; + } + + QPoint p2() // const + { + return pt2; + } + + int dx() // const + { + return pt2.x() - pt1.x(); + } + + int dy() // const + { + return pt2.y() - pt1.y(); + } + + void translate(ref QPoint point) + { + pt1 += point; + pt2 += point; + } + + void translate(int adx, int ady) + { + translate(QPoint(adx, ady)); + } + + QLine translated(ref QPoint p) // const + { + return QLine(pt1 + p, pt2 + p); + } + + QLine translated(int adx, int ady) // const + { + return translated(QPoint(adx, ady)); + } + + void p1(ref QPoint aP1) + { + pt1 = aP1; + } + + void p2(ref QPoint aP2) + { + pt2 = aP2; + } + + void setP1(ref QPoint aP1) // for convenience + { + pt1 = aP1; + } + + void setP2(ref QPoint aP2) // for convenience + { + pt2 = aP2; + } + + void setPoints(ref QPoint aP1, ref QPoint aP2) + { + pt1 = aP1; + pt2 = aP2; + } + + void setLine(int aX1, int aY1, int aX2, int aY2) + { + pt1 = QPoint(aX1, aY1); + pt2 = QPoint(aX2, aY2); + } + + bool opEquals(ref QLine d) // const + { + return pt1 == d.pt1 && pt2 == d.pt2; + } + + public final void writeTo(QDataStream arg__1) { + qtd_QLine_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void readFrom(QDataStream arg__1) { + qtd_QLine_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + +private: + QPoint pt1, pt2; +} + + +public enum QLineF_IntersectType { + NoIntersection = 0, + BoundedIntersection = 1, + UnboundedIntersection = 2 +} + +public struct QLineF +{ + + alias QLineF_IntersectType IntersectType; + + alias QLineF_IntersectType.NoIntersection NoIntersection; + alias QLineF_IntersectType.BoundedIntersection BoundedIntersection; + alias QLineF_IntersectType.UnboundedIntersection UnboundedIntersection; + + public static QLineF opCall() { + QLineF ln; + ln.pt1 = QPointF(); + ln.pt2 = QPointF(); + return ln; + } + + public this(QPointF apt1, QPointF apt2) { + pt1 = apt1; + pt2 = apt2; + } + + public this(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos) { + pt1 = QPointF(x1pos, y1pos); + pt2 = QPointF(x2pos, y2pos); + } + + public this(QLine line){ + pt1 = QPointF(line.p1()); + pt2 = QPointF(line.p2()); + } + + public final bool isNull() // const + { + return qtd_QLineF_isNull(&this); + } + + qreal x1() // const + { + return pt1.x(); + } + + qreal y1() // const + { + return pt1.y(); + } + + qreal x2() // const + { + return pt2.x(); + } + + qreal y2() // const + { + return pt2.y(); + } + + QPointF p1() // const + { + return pt1; + } + + QPointF p2() // const + { + return pt2; + } + + qreal dx() // const + { + return pt2.x() - pt1.x(); + } + + qreal dy() // const + { + return pt2.y() - pt1.y(); + } + + QLineF normalVector() // const + { + return QLineF(p1(), p1() + QPointF(dy(), -dx())); + } + + void translate(ref QPointF point) + { + pt1 += point; + pt2 += point; + } + + void translate(qreal adx, qreal ady) + { + this.translate(QPointF(adx, ady)); + } + + QLineF translated(ref QPointF p) // const + { + return QLineF(pt1 + p, pt2 + p); + } + + QLineF translated(qreal adx, qreal ady) // const + { + return translated(QPointF(adx, ady)); + } + + void setLength(qreal len) + { + if (isNull()) + return; + QLineF v = unitVector(); + pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len); + } + + void length(qreal len) + { + if (isNull()) + return; + QLineF v = unitVector(); + pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len); + } + + QPointF pointAt(qreal t) // const + { + qreal vx = pt2.x() - pt1.x(); + qreal vy = pt2.y() - pt1.y(); + return QPointF(pt1.x() + vx * t, pt1.y() + vy * t); + } + + QLine toLine() // const + { + return QLine(pt1.toPoint(), pt2.toPoint()); + } + + void setP1(ref QPointF aP1) + { + pt1 = aP1; + } + + void setP2(ref QPointF aP2) + { + pt2 = aP2; + } + + void p1(ref QPointF aP1) + { + pt1 = aP1; + } + + void p2(ref QPointF aP2) + { + pt2 = aP2; + } + + void setPoints(ref QPointF aP1, ref QPointF aP2) + { + pt1 = aP1; + pt2 = aP2; + } + + void setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2) + { + pt1 = QPointF(aX1, aY1); + pt2 = QPointF(aX2, aY2); + } + + bool opEquals(ref QLineF d) // const + { + return pt1 == d.pt1 && pt2 == d.pt2; + } + + public final double angle() { + return qtd_QLineF_angle(&this); + } + + public final double angle(ref QLineF l) { + return qtd_QLineF_angle_QLineF(&this, &l); + } + + public final double angleTo(ref QLineF l) { + return qtd_QLineF_angleTo_QLineF(&this, &l); + } + + // ### Qt 5: rename intersects() or intersection() and rename IntersectType IntersectionType + private final QLineF_IntersectType intersect(ref QLineF l, QPointF* intersectionPoint) { + return cast(QLineF_IntersectType) qtd_QLineF_intersect_QLineF_nativepointerQPointF(&this, &l, intersectionPoint); + } + + public final double length() { + return qtd_QLineF_length(&this); + } + + public final void writeTo(QDataStream arg__1) { + qtd_QLineF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void readFrom(QDataStream arg__1) { + qtd_QLineF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void setAngle(double angle) { + qtd_QLineF_setAngle_double(&this, angle); + } + + public final QLineF unitVector() { + return qtd_QLineF_unitVector(&this); + } + + public static QLineF fromPolar(double length, double angle) { + return qtd_QLineF_fromPolar_double_double(length, angle); + } + + private: + QPointF pt1, pt2; +} + + +// C wrappers +// QLine +private extern(C) void qtd_QLine_writeTo_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void qtd_QLine_readFrom_QDataStream(void* __this_nativeId, + void* arg__1); + +// QLineF +private extern(C) bool qtd_QLineF_isNull(void* __this_nativeId); +private extern(C) double qtd_QLineF_angle(void* __this_nativeId); +private extern(C) double qtd_QLineF_angle_QLineF(void* __this_nativeId, + void* l0); +private extern(C) double qtd_QLineF_angleTo_QLineF(void* __this_nativeId, + void* l0); +private extern(C) int qtd_QLineF_intersect_QLineF_nativepointerQPointF(void* __this_nativeId, + void* l0, + void* intersectionPoint1); +private extern(C) double qtd_QLineF_length(void* __this_nativeId); +private extern(C) void qtd_QLineF_writeTo_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void qtd_QLineF_readFrom_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void qtd_QLineF_setAngle_double(void* __this_nativeId, + double angle0); + +private extern(C) QLineF qtd_QLineF_unitVector(void* __this_nativeId); +private extern(C) QLineF qtd_QLineF_fromPolar_double_double(double length0, + double angle1); diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QLineF.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QLineF.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,4 @@ +module qt.core.QLineF; +/* dummy */ + +public import qt.core.QLine; \ No newline at end of file diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QModelIndex.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QModelIndex.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,121 @@ +module qt.core.QModelIndex; + +public import qt.QGlobal; +private import qt.QtDObject; + +// automatic imports------------- +private import qt.core.QVariant; +private import qt.core.QAbstractItemModel; +public import qt.core.Qt; + + +public struct QModelIndex +{ + public static QModelIndex opCall() { + QModelIndex mi; + mi.r = mi.c = -1; + mi.p = mi.m = null; + return mi; + } + + public final QModelIndex child(int row, int column) { + return __qtd_QModelIndex_child_int_int(&this, row, column); + } + + public final int column() { + return __qtd_QModelIndex_column(&this); + } + + public final QVariant data(int role = 0) { + void* __qt_return_value = __qtd_QModelIndex_data_int(&this, role); + return new QVariant(__qt_return_value, false); + } + + public final int flags() { + return __qtd_QModelIndex_flags(&this); + } + + public final long internalId() { + return __qtd_QModelIndex_internalId(&this); + } + + public final void* internalPointer() { + //return __qtd_QModelIndex_internalPointer(&this); + return p; + } + + public final Object object() { + return cast(Object) p; + } + + public final bool isValid() { + return __qtd_QModelIndex_isValid(&this); + } + + public final QAbstractItemModel model() { +// void* __qt_return_value = __qtd_QModelIndex_model(&this); + void* __qt_return_value = m; + if (__qt_return_value is null) + return null; + void* d_obj = __QObject_entity(__qt_return_value); + return cast(QAbstractItemModel) d_obj; + } + + private final bool operator_less(QModelIndex other) { + return __qtd_QModelIndex_operator_less_QModelIndex(&this, other); + } + + private final bool operator_equal(QModelIndex other) { + return __qtd_QModelIndex_operator_equal_QModelIndex(&this, other); + } + + public final QModelIndex parent() { + return __qtd_QModelIndex_parent(&this); + } + + public final int row() { + return __qtd_QModelIndex_row(&this); + } + + public final QModelIndex sibling(int row, int column) { + return __qtd_QModelIndex_sibling_int_int(&this, row, column); + } + +private: + int r; + int c; + void *p; + void *m; +} + + +alias QModelIndex QModelIndexAccessor; + + +// C wrappers +private extern(C) void* __qtd_QModelIndex_QModelIndex_QModelIndex(QModelIndex other0); +private extern(C) QModelIndex __qtd_QModelIndex_child_int_int(void* __this_nativeId, + int row0, + int column1); +private extern(C) int __qtd_QModelIndex_column(void* __this_nativeId); +private extern(C) void* __qtd_QModelIndex_data_int(void* __this_nativeId, + int role0); +private extern(C) int __qtd_QModelIndex_flags(void* __this_nativeId); +private extern(C) long __qtd_QModelIndex_internalId(void* __this_nativeId); +private extern(C) void* __qtd_QModelIndex_internalPointer(void* __this_nativeId); +private extern(C) bool __qtd_QModelIndex_isValid(void* __this_nativeId); +private extern(C) void* __qtd_QModelIndex_model(void* __this_nativeId); +private extern(C) bool __qtd_QModelIndex_operator_less_QModelIndex(void* __this_nativeId, + QModelIndex other0); +private extern(C) bool __qtd_QModelIndex_operator_equal_QModelIndex(void* __this_nativeId, + QModelIndex other0); +private extern(C) QModelIndex __qtd_QModelIndex_parent(void* __this_nativeId); +private extern(C) int __qtd_QModelIndex_row(void* __this_nativeId); +private extern(C) QModelIndex __qtd_QModelIndex_sibling_int_int(void* __this_nativeId, + int row0, + int column1); +// Just the private functions for abstract functions implemeneted in superclasses + + + +// Virtual Dispatch functions diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QPoint.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QPoint.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,229 @@ +module qt.core.QPoint; + +public import qt.QGlobal; +public import qt.core.Qt; +public import qt.core.QDataStream; + + +public struct QPoint +{ + +// Functions + public static QPoint opCall() { + QPoint pt; + pt.xp = pt.yp = 0; + return pt; + } + + public this(int xpos, int ypos) { + xp = xpos; + yp = ypos; + } + + bool isNull() // const + { return xp == 0 && yp == 0; } + + int x() // const + { return xp; } + + int y() // const + { return yp; } + + void x(int xpos) + { xp = xpos; } + + void y(int ypos) + { yp = ypos; } + + void setX(int xpos) // for convenience + { xp = xpos; } + + void setY(int ypos) // for convenience + { yp = ypos; } + + public final int manhattanLength() { + return qtd_QPoint_manhattanLength(&this); + } +/* +inline int &rx() +{ return xp; } + +inline int &ry() +{ return yp; } +*/ + + QPoint opAddAssign(ref QPoint p) + { xp+=p.xp; yp+=p.yp; return this; } + + QPoint opSubAssign(ref QPoint p) + { xp-=p.xp; yp-=p.yp; return this; } + + QPoint opMulAssign(qreal c) + { xp = qRound(xp*c); yp = qRound(yp*c); return this; } + + bool opEquals(ref QPoint p) + { return xp == p.xp && yp == p.yp; } + + QPoint opAdd(ref QPoint p) + { return QPoint(this.xp+p.xp, this.yp+p.yp); } + + QPoint opSub(ref QPoint p) + { return QPoint(this.xp-p.xp, this.yp-p.yp); } + + QPoint opMul(qreal c) + { return QPoint(qRound(this.xp*c), qRound(this.yp*c)); } + + QPoint opDivAssign(qreal c) + { + xp = qRound(xp/c); + yp = qRound(yp/c); + return this; + } + + QPoint opDiv(qreal c) + { + return QPoint(qRound(this.xp/c), qRound(this.yp/c)); + } + + public final void writeTo(QDataStream arg__1) { + qtd_QPoint_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void readFrom(QDataStream arg__1) { + qtd_QPoint_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + +private: + // ### Qt 5; remove the ifdef and just have the same order on all platforms. + version(OSX) + { + int yp; + int xp; + } + else + { + int xp; + int yp; + } +} + + +public struct QPointF +{ + public static QPointF opCall() { + QPointF pt; + pt.xp = pt.yp = 0; + return pt; + } + + public this(qreal xpos, qreal ypos) { + xp = xpos; + yp = ypos; + } + + public this(QPoint p) { + xp = p.x(); + yp = p.y(); + } + + bool isNull() //const + { + return qIsNull(xp) && qIsNull(yp); + } + + qreal x() //const + { + return xp; + } + + qreal y() //const + { + return yp; + } + + void x(qreal xpos) + { + xp = xpos; + } + + void y(qreal ypos) + { + yp = ypos; + } +/* +inline qreal &QPointF::rx() +{ + return xp; +} + +inline qreal &QPointF::ry() +{ + return yp; +} +*/ + + QPointF opAddAssign(ref QPointF p) + { xp+=p.xp; yp+=p.yp; return this; } + + QPointF opSubAssign(ref QPointF p) + { xp-=p.xp; yp-=p.yp; return this; } + + QPointF opMulAssign(qreal c) + { xp*=c; yp*=c; return this; } + + bool opEquals(ref QPointF p) + { return qFuzzyCompare(xp, p.xp) && qFuzzyCompare(yp, p.yp); } + + QPointF opAdd(ref QPointF p) + { return QPointF(this.xp+p.xp, this.yp+p.yp); } + + QPointF opSub(ref QPointF p) + { return QPointF(this.xp-p.xp, this.yp-p.yp); } + + QPointF opMul(qreal c) + { return QPointF(this.xp*c, this.yp*c); } + + QPointF opDivAssign(qreal c) + { + xp/=c; + yp/=c; + return this; + } + + QPointF opDiv(qreal c) + { + return QPointF(xp/c, yp/c); + } + + QPoint toPoint() //const + { + return QPoint(qRound(xp), qRound(yp)); + } + + public final void writeTo(QDataStream arg__1) { + qtd_QPointF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void readFrom(QDataStream arg__1) { + qtd_QPointF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + +private: + qreal xp; + qreal yp; +} + + +// C wrappers +// QPoint +private extern(C) int qtd_QPoint_manhattanLength(void* __this_nativeId); +private extern(C) void qtd_QPoint_writeTo_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void qtd_QPoint_readFrom_QDataStream(void* __this_nativeId, + void* arg__1); + +// QPointF +private extern(C) void qtd_QPointF_writeTo_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void qtd_QPointF_readFrom_QDataStream(void* __this_nativeId, + void* arg__1); \ No newline at end of file diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QPointF.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QPointF.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,4 @@ +module qt.core.QPointF; +/* dummy */ + +public import qt.core.QPoint; diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QRect.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QRect.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,376 @@ +module qt.core.QRect; + +public import qt.QGlobal; +public import qt.core.Qt; + +public import qt.core.QDataStream; +public import qt.core.QSize; +public import qt.core.QPoint; + + +public struct QRect +{ + public static QRect opCall() { + QRect rt; + rt.x1 = rt.y1 = 0; + rt.x2 = rt.y2 = -1; + return rt; + } + + public this(int aleft, int atop, int awidth, int aheight) + { + x1 = aleft; + y1 = atop; + x2 = (aleft + awidth - 1); + y2 = (atop + aheight - 1); + } + + public this(QPoint atopLeft, QPoint abottomRight) + { + x1 = atopLeft.x(); + y1 = atopLeft.y(); + x2 = abottomRight.x(); + y2 = abottomRight.y(); + } + + public this(ref QPoint atopLeft, ref QSize asize) + { + x1 = atopLeft.x(); + y1 = atopLeft.y(); + x2 = (x1+asize.width() - 1); + y2 = (y1+asize.height() - 1); + } + + bool isNull() // const + { return x2 == x1 - 1 && y2 == y1 - 1; } + + bool isEmpty() // const + { return x1 > x2 || y1 > y2; } + + bool isValid() // const + { return x1 <= x2 && y1 <= y2; } + + int left() // const + { return x1; } + + int top() // const + { return y1; } + + int right() // const + { return x2; } + + int bottom() // const + { return y2; } + + int x() // const + { return x1; } + + int y() // const + { return y1; } + + void left(int pos) + { x1 = pos; } + + void top(int pos) + { y1 = pos; } + + void right(int pos) + { x2 = pos; } + + void bottom(int pos) + { y2 = pos; } + + void setLeft(int pos) + { x1 = pos; } + + void setTop(int pos) + { y1 = pos; } + + void setRight(int pos) + { x2 = pos; } + + void setBottom(int pos) + { y2 = pos; } + + void setTopLeft(ref QPoint p) + { x1 = p.x(); y1 = p.y(); } + + void setBottomRight(ref QPoint p) + { x2 = p.x(); y2 = p.y(); } + + void setTopRight(ref QPoint p) + { x2 = p.x(); y1 = p.y(); } + + void setBottomLeft(ref QPoint p) + { x1 = p.x(); y2 = p.y(); } + + void setX(int ax) + { x1 = ax; } + + void setY(int ay) + { y1 = ay; } + + QPoint topLeft() // const + { return QPoint(x1, y1); } + + QPoint bottomRight() // const + { return QPoint(x2, y2); } + + QPoint topRight() // const + { return QPoint(x2, y1); } + + QPoint bottomLeft() // const + { return QPoint(x1, y2); } + + QPoint center() // const + { return QPoint((x1+x2)/2, (y1+y2)/2); } + + int width() // const + { return x2 - x1 + 1; } + + int height() // const + { return y2 - y1 + 1; } + + QSize size() // const + { return QSize(width(), height()); } + + void translate(int dx, int dy) + { + x1 += dx; + y1 += dy; + x2 += dx; + y2 += dy; + } + + void translate(ref QPoint p) + { + x1 += p.x(); + y1 += p.y(); + x2 += p.x(); + y2 += p.y(); + } + + QRect translated(int dx, int dy) // const + { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); } + + QRect translated(ref QPoint p) // const + { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); } + + void moveTo(int ax, int ay) + { + x2 += ax - x1; + y2 += ay - y1; + x1 = ax; + y1 = ay; + } + + void moveTo(ref QPoint p) + { + x2 += p.x() - x1; + y2 += p.y() - y1; + x1 = p.x(); + y1 = p.y(); + } + + void moveLeft(int pos) + { x2 += (pos - x1); x1 = pos; } + + void moveTop(int pos) + { y2 += (pos - y1); y1 = pos; } + + void moveRight(int pos) + { + x1 += (pos - x2); + x2 = pos; + } + + void moveBottom(int pos) + { + y1 += (pos - y2); + y2 = pos; + } + + void moveTopLeft(ref QPoint p) + { + moveLeft(p.x()); + moveTop(p.y()); + } + + void moveBottomRight(ref QPoint p) + { + moveRight(p.x()); + moveBottom(p.y()); + } + + void moveTopRight(ref QPoint p) + { + moveRight(p.x()); + moveTop(p.y()); + } + + void moveBottomLeft(ref QPoint p) + { + moveLeft(p.x()); + moveBottom(p.y()); + } + + void getRect(int *ax, int *ay, int *aw, int *ah) // const + { + *ax = x1; + *ay = y1; + *aw = x2 - x1 + 1; + *ah = y2 - y1 + 1; + } + + void setRect(int ax, int ay, int aw, int ah) + { + x1 = ax; + y1 = ay; + x2 = (ax + aw - 1); + y2 = (ay + ah - 1); + } + + void getCoords(int *xp1, int *yp1, int *xp2, int *yp2) // const + { + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; + } + + void setCoords(int xp1, int yp1, int xp2, int yp2) + { + x1 = xp1; + y1 = yp1; + x2 = xp2; + y2 = yp2; + } + + QRect adjusted(int xp1, int yp1, int xp2, int yp2) // const + { return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); } + + void adjust(int dx1, int dy1, int dx2, int dy2) + { + x1 += dx1; + y1 += dy1; + x2 += dx2; + y2 += dy2; + } + + void setWidth(int w) + { x2 = (x1 + w - 1); } + + void setHeight(int h) + { y2 = (y1 + h - 1); } + + void setSize(ref QSize s) + { + x2 = (s.width() + x1 - 1); + y2 = (s.height() + y1 - 1); + } + + bool contains(int ax, int ay, bool aproper) // const + { + return contains(QPoint(ax, ay), aproper); + } + + bool contains(int ax, int ay) // const + { + return contains(QPoint(ax, ay), false); + } + + QRect opOrAssign(ref QRect r) + { + this = this | r; + return this; + } + + QRect opAndAssign(ref QRect r) + { + this = this & r; + return this; + } + + QRect intersected(ref QRect other) // const + { + return this & other; + } + + QRect united(ref QRect r) // const + { + return this | r; + } + + bool opEquals(ref QRect r) + { + return x1==r.x1 && x2==r.x2 && y1==r.y1 && y2==r.y2; + } + + public final void writeTo(QDataStream arg__1) { + qtd_QRect_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void readFrom(QDataStream arg__1) { + qtd_QRect_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final QRect opAnd(ref QRect r) { + return qtd_QRect_operator_and_QRect(&this, &r); + } + + public final QRect opOr(ref QRect r) { + return qtd_QRect_operator_or_QRect(&this, &r); + } + + public final bool contains(QPoint p, bool proper = false) { + return qtd_QRect_contains_QPoint_bool(&this, &p, proper); + } + + public final bool contains(QRect r, bool proper = false) { + return qtd_QRect_contains_QRect_bool(&this, &r, proper); + } + + public final bool intersects(QRect r) { + return qtd_QRect_intersects_QRect(&this, &r); + } + + public final QRect normalized() { + return qtd_QRect_normalized(&this); + } + +private: + version(OSX) + { + int y1; + int x1; + int y2; + int x2; + } + else + { + int x1; + int y1; + int x2; + int y2; + } +} + + +// C wrappers +private extern(C) bool qtd_QRect_contains_QPoint_bool(void* __this_nativeId, + void* p0, + bool proper1); +private extern(C) bool qtd_QRect_contains_QRect_bool(void* __this_nativeId, + void* r0, + bool proper1); +private extern(C) bool qtd_QRect_intersects_QRect(void* __this_nativeId, + void* r0); +private extern(C) QRect qtd_QRect_normalized(void* __this_nativeId); +private extern(C) void qtd_QRect_writeTo_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void qtd_QRect_readFrom_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) QRect qtd_QRect_operator_and_QRect(void* __this_nativeId, + void* r0); +private extern(C) QRect qtd_QRect_operator_or_QRect(void* __this_nativeId, + void* r0); \ No newline at end of file diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QRectF.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QRectF.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,329 @@ +module qt.core.QRectF; + +public import qt.QGlobal; +public import qt.core.Qt; +public import qt.core.QPointF; +public import qt.core.QRect; +public import qt.core.QSizeF; +public import qt.core.QDataStream; + +public struct QRectF +{ + + public static QRectF opCall() + { + QRectF rt; + rt.xp = rt.yp = 0.; + rt.w = rt.h = 0.; + return rt; + } + + public this(qreal aleft, qreal atop, qreal awidth, qreal aheight) + { + xp = aleft; + yp = atop; + w = awidth; + h = aheight; + } + + public this(QPointF atopLeft, QSizeF asize) + { + xp = atopLeft.x(); + yp = atopLeft.y(); + w = asize.width(); + h = asize.height(); + } + + public this(QPointF atopLeft, QPointF abottomRight) + { + xp = atopLeft.x(); + yp = atopLeft.y(); + w = abottomRight.x() - xp; + h = abottomRight.y() - yp; + } + + public this(QRect r) + { + xp = r.x(); + yp = r.y(); + w = r.width(); + h = r.height(); + } + + bool isNull() // conts + { return qIsNull(w) && qIsNull(h); } + + bool isEmpty() // conts + { return w <= 0. || h <= 0.; } + + bool isValid() // conts + { return w > 0. && h > 0.; } + + qreal x() // conts + { return xp; } + + qreal y() // conts + { return yp; } + + qreal left() // const + { return xp; } + + qreal top() // const + { return yp; } + + qreal right() // const + { return xp + w; } + + qreal bottom() // const + { return yp + h; } + + QPointF topLeft() // const + { return QPointF(xp, yp); } + + QPointF bottomRight() // const + { return QPointF(xp+w, yp+h); } + + QPointF topRight() // const + { return QPointF(xp+w, yp); } + + QPointF bottomLeft() // const + { return QPointF(xp, yp+h); } + + void setLeft(qreal pos) { qreal diff = pos - xp; xp += diff; w -= diff; } + + void setRight(qreal pos) { w = pos - xp; } + + void setTop(qreal pos) { qreal diff = pos - yp; yp += diff; h -= diff; } + + void setBottom(qreal pos) { h = pos - yp; } + + void setTopLeft(ref QPointF p) { setLeft(p.x()); setTop(p.y()); } + + void setTopRight(ref QPointF p) { setRight(p.x()); setTop(p.y()); } + + void setBottomLeft(ref QPointF p) { setLeft(p.x()); setBottom(p.y()); } + + void setBottomRight(ref QPointF p) { setRight(p.x()); setBottom(p.y()); } + + QPointF center() // conts + { return QPointF(xp + w/2, yp + h/2); } + + void moveLeft(qreal pos) { xp = pos; } + + void moveTop(qreal pos) { yp = pos; } + + void moveRight(qreal pos) { xp = pos - w; } + + void moveBottom(qreal pos) { yp = pos - h; } + + void moveTopLeft(ref QPointF p) { moveLeft(p.x()); moveTop(p.y()); } + + void moveTopRight(ref QPointF p) { moveRight(p.x()); moveTop(p.y()); } + + void moveBottomLeft(ref QPointF p) { moveLeft(p.x()); moveBottom(p.y()); } + + void moveBottomRight(ref QPointF p) { moveRight(p.x()); moveBottom(p.y()); } + + void moveCenter(ref QPointF p) { xp = p.x() - w/2; yp = p.y() - h/2; } + + qreal width() // conts + { return w; } + + qreal height() // conts + { return h; } + + QSizeF size() // conts + { return QSizeF(w, h); } + + void translate(qreal dx, qreal dy) + { + xp += dx; + yp += dy; + } + + void translate(ref QPointF p) + { + xp += p.x(); + yp += p.y(); + } + + void moveTo(qreal ax, qreal ay) + { + xp = ax; + yp = ay; + } + + void moveTo(ref QPointF p) + { + xp = p.x(); + yp = p.y(); + } + + QRectF translated(qreal dx, qreal dy) // conts + { return QRectF(xp + dx, yp + dy, w, h); } + + QRectF translated(ref QPointF p) // conts + { return QRectF(xp + p.x(), yp + p.y(), w, h); } + + void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) // conts + { + *ax = this.xp; + *ay = this.yp; + *aaw = this.w; + *aah = this.h; + } + + void setRect(qreal ax, qreal ay, qreal aaw, qreal aah) + { + this.xp = ax; + this.yp = ay; + this.w = aaw; + this.h = aah; + } + + void getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) // conts + { + *xp1 = xp; + *yp1 = yp; + *xp2 = xp + w; + *yp2 = yp + h; + } + + void setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) + { + xp = xp1; + yp = yp1; + w = xp2 - xp1; + h = yp2 - yp1; + } + + void adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) + { xp += xp1; yp += yp1; w += xp2 - xp1; h += yp2 - yp1; } + + QRectF adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) // conts + { return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); } + + void setWidth(qreal aw) // for convenience + { this.w = aw; } + + void setHeight(qreal ah) // for convenience + { this.h = ah; } + + void setSize(ref QSizeF s) // for convenience + { + w = s.width(); + h = s.height(); + } + + void width(qreal aw) + { this.w = aw; } + + void height(qreal ah) + { this.h = ah; } + + void size(ref QSizeF s) + { + w = s.width(); + h = s.height(); + } + + bool contains(qreal ax, qreal ay) // conts + { + return contains(QPointF(ax, ay)); + } + + QRectF opOrAssign(ref QRectF r) + { + this = this | r; + return this; + } + + QRectF opAndAssign(ref QRectF r) + { + this = this & r; + return this; + } + + QRectF intersected(ref QRectF r) // conts + { + return this & r; + } + + QRectF united(ref QRectF r) // conts + { + return this | r; + } + + bool opEquals(ref QRectF r) + { + return qFuzzyCompare(xp, r.xp) && qFuzzyCompare(yp, r.yp) + && qFuzzyCompare(w, r.w) && qFuzzyCompare(h, r.h); + } + + QRect toRect() // conts + { + return QRect(qRound(xp), qRound(yp), qRound(w), qRound(h)); + } + + public final bool contains(QPointF p) { + return qtd_QRectF_contains_QPointF(&this, &p); + } + + public final bool contains(QRectF r) { + return qtd_QRectF_contains_QRectF(&this, &r); + } + + public final bool intersects(QRectF r) { + return qtd_QRectF_intersects_QRectF(&this, &r); + } + + public final QRectF normalized() { + return qtd_QRectF_normalized(&this); + } + + public final QRectF opAnd(ref QRectF r) { + return qtd_QRectF_operator_and_QRectF(&this, &r); + } + + public final void writeTo(QDataStream arg__1) { + qtd_QRectF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void readFrom(QDataStream arg__1) { + qtd_QRectF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final QRectF opOr(ref QRectF r) { + return qtd_QRectF_operator_or_QRectF(&this, &r); + } + + public final QRect toAlignedRect() // const + { + return qtd_QRectF_toAlignedRect(&this); + } + +private: + qreal xp; + qreal yp; + qreal w; + qreal h; +} + + +// C wrappers +private extern(C) bool qtd_QRectF_contains_QPointF(void* __this_nativeId, + void* p0); +private extern(C) bool qtd_QRectF_contains_QRectF(void* __this_nativeId, + void* r0); +private extern(C) bool qtd_QRectF_intersects_QRectF(void* __this_nativeId, + void* r0); +private extern(C) QRectF qtd_QRectF_normalized(void* __this_nativeId); +private extern(C) QRectF qtd_QRectF_operator_and_QRectF(void* __this_nativeId, + void* r0); +private extern(C) void qtd_QRectF_writeTo_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void qtd_QRectF_readFrom_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) QRectF qtd_QRectF_operator_or_QRectF(void* __this_nativeId, + void* r0); +private extern(C) QRect qtd_QRectF_toAlignedRect(void* __this_nativeId); \ No newline at end of file diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QSize.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QSize.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,275 @@ +module qt.core.QSize; + +public import qt.QGlobal; +public import qt.core.Qt; + + +public struct QSize +{ +/* ctors, reserved for D2 + public this() + { wd = ht = -1; } + + public this(int w, int h) + { wd = w; ht = h; } +*/ + + public static QSize opCall() { + QSize sz; + sz.wd = sz.ht = -1; + return sz; + } + + public this(int w, int h) { + wd = w; + ht = h; + } + + final bool isNull() + { return wd==0 && ht==0; } + + final bool isEmpty() + { return wd<1 || ht<1; } + + final bool isValid() + { return wd>=0 && ht>=0; } + + final int width() + { return wd; } + + final int height() + { return ht; } + + final void width(int w) + { wd = w; } + + final void height(int h) + { ht = h; } + + final void setWidth(int w) // for convenience + { wd = w; } + + final void setHeight(int h) // for convenience + { ht = h; } + + void transpose() { + int tmp = wd; + wd = ht; + ht = tmp; + } + + void scale(int w, int h, Qt.AspectRatioMode mode) { + scale(QSize(w, h), mode); + } + + void scale(ref QSize s, Qt.AspectRatioMode mode) { + __qtd_QSize_scale_QSize_AspectRatioMode(&this, &s, mode); + } + + QSize expandedTo(ref QSize otherSize) { + return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); + } + + QSize boundedTo(ref QSize otherSize) { + return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); + } +/* + public final void writeTo(QDataStream arg__1) { + __qtd_QSize_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void readFrom(QDataStream arg__1) { + __qtd_QSize_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } +*/ + QSize opAddAssign(ref QSize s) + { wd+=s.wd; ht+=s.ht; return this; } + + QSize opSubAssign(ref QSize s) + { wd-=s.wd; ht-=s.ht; return this; } + + QSize opMulAssign(qreal c) + { wd = qRound(wd*c); ht = qRound(ht*c); return this; } + + bool opEquals(ref QSize s) + { return wd == s.wd && ht == s.ht; } + + QSize opAdd(ref QSize s) + { return QSize(this.wd+s.wd, this.ht+s.ht); } + + QSize opSub(ref QSize s) + { return QSize(this.wd-s.wd, this.ht-s.ht); } + + QSize opMul(qreal c) + { return QSize(qRound(this.wd*c), qRound(this.ht*c)); } + + QSize opDivAssign(qreal c) { + assert(!qFuzzyCompare(c + 1, 1.)); + wd = qRound(wd/c); ht = qRound(ht/c); + return this; + } + + QSize opDiv(qreal c) { + assert(!qFuzzyCompare(c + 1, 1.)); + return QSize(qRound(this.wd/c), qRound(this.ht/c)); + } + +private: + int wd; + int ht; +} + + +public struct QSizeF +{ +/* ctors, reserved for D2 + this() + { wd = ht = -1.; } + + this(ref QSize sz) + { wd = sz.width(); ht = sz.height(); } + + this(qreal w, qreal h) + { wd = w; ht = h; } +*/ + public static QSizeF opCall() { + QSizeF sz; + sz.wd = sz.ht = -1.; + return sz; + } + + public static QSizeF opCall(ref QSizeF s) { + QSizeF sz; + sz.wd = s.width(); sz.ht = s.height(); + return sz; + } + + public static QSizeF opCall(qreal w, qreal h) { + QSizeF sz; + sz.wd = w; sz.ht = h; + return sz; + } + + bool isNull() + { return qIsNull(wd) && qIsNull(ht); } + + bool isEmpty() + { return wd <= 0. || ht <= 0.; } + + bool isValid() + { return wd >= 0. && ht >= 0.; } + + qreal width() + { return wd; } + + qreal height() + { return ht; } + + void width(qreal w) + { wd = w; } + + void height(qreal h) + { ht = h; } + + void setWidth(qreal w) + { wd = w; } + + void setHeight(qreal h) + { ht = h; } + + void scale(qreal w, qreal h, Qt.AspectRatioMode mode) + { scale(QSizeF(w, h), mode); } + + public final void scale(QSizeF s, Qt.AspectRatioMode mode) + { __qtd_QSizeF_scale_QSizeF_AspectRatioMode(&this, &s, mode); } + + void transpose() { + qreal tmp = wd; + wd = ht; + ht = tmp; + } + + QSizeF expandedTo(ref QSizeF otherSize) + { return QSizeF(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); } + + QSizeF boundedTo(ref QSizeF otherSize) + { return QSizeF(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); } + + QSize toSize() + { return QSize(qRound(wd), qRound(ht)); } +/* + public final void writeTo(QDataStream arg__1) { + __qtd_QSizeF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); + } + + public final void readFrom(QDataStream arg__1) { + __qtd_QSizeF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); +*/ + QSizeF opAddAssign(ref QSizeF s) + { wd += s.wd; ht += s.ht; return this; } + + QSizeF opSubAssign(ref QSizeF s) + { wd -= s.wd; ht -= s.ht; return this; } + + QSizeF opMulAssign(qreal c) + { wd *= c; ht *= c; return this; } + + bool opEquals(ref QSizeF s) + { return qFuzzyCompare(wd, s.wd) && qFuzzyCompare(ht, s.ht); } + + QSizeF opAdd(ref QSizeF s) + { return QSizeF(this.wd+s.wd, this.ht+s.ht); } + + QSizeF opSub(ref QSizeF s) + { return QSizeF(this.wd-s.wd, this.ht-s.ht); } + + QSizeF opMul(qreal c) + { return QSizeF(this.wd*c, this.ht*c); } + + QSizeF opDivAssign(qreal c) + { + assert(!qFuzzyCompare(c + 1, 1.)); + wd = wd/c; ht = ht/c; + return this; + } + + QSizeF opDiv(qreal c) + { + assert(!qFuzzyCompare(c + 1, 1.)); + return QSizeF(this.wd/c, this.ht/c); + } + +private: + qreal wd; + qreal ht; +} + + +extern (C) void qtd_append_array_QSize(QSize[]* arr, QSize arg) +{ + *arr ~= arg; +} + +extern (C) void qtd_append_array_QSizeF(QSizeF[]* arr, QSizeF arg) +{ + *arr ~= arg; +} + +// C wrappers +// QSize +private extern(C) void __qtd_QSize_scale_QSize_AspectRatioMode(void* __this_nativeId, + void* s0, + int mode1); +private extern(C) void __qtd_QSize_writeTo_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void __qtd_QSize_readFrom_QDataStream(void* __this_nativeId, + void* arg__1); + +// QSizeF +private extern(C) void __qtd_QSizeF_writeTo_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void __qtd_QSizeF_readFrom_QDataStream(void* __this_nativeId, + void* arg__1); +private extern(C) void __qtd_QSizeF_scale_QSizeF_AspectRatioMode(void* __this_nativeId, + void* s0, + int mode1); \ No newline at end of file diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QSizeF.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QSizeF.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,4 @@ +module qt.core.QSizeF; +/* dummy */ + +public import qt.core.QSize; diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/core/QVariant.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/core/QVariant.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,715 @@ +module qt.core.QVariant; + +public import qt.QGlobal; +private import qt.QtDObject; +private import qt.core.QMetaType; + +// automatic imports------------- +private import qt.core.QSizeF; +private import qt.core.QPoint; +private import qt.core.QRectF; +public import qt.core.Qt; +private import qt.core.QDateTime; +private import qt.core.QDataStream; +private import qt.core.QTime; +private import qt.core.QUrl; +private import qt.core.QRegExp; +private import qt.core.QBitArray; +private import qt.core.QLine; +private import qt.core.QByteArray; +private import qt.core.QSize; +private import qt.core.QDate; +private import qt.core.QPointF; +private import qt.core.QLineF; +private import qt.core.QRect; +private import qt.core.QLocale; + +import std.string; + + +public class QVariant : QtDObject +{ + enum Type { + Invalid = 0, + + Bool = 1, + Int = 2, + UInt = 3, + LongLong = 4, + ULongLong = 5, + Double = 6, + Char = 7, + Map = 8, + List = 9, + String = 10, + StringList = 11, + ByteArray = 12, + BitArray = 13, + Date = 14, + Time = 15, + DateTime = 16, + Url = 17, + Locale = 18, + Rect = 19, + RectF = 20, + Size = 21, + SizeF = 22, + Line = 23, + LineF = 24, + Point = 25, + PointF = 26, + RegExp = 27, + LastCoreType = RegExp, + + // value 62 is internally reserved + + Font = 64, + Pixmap = 65, + Brush = 66, + Color = 67, + Palette = 68, + Icon = 69, + Image = 70, + Polygon = 71, + Region = 72, + Bitmap = 73, + Cursor = 74, + SizePolicy = 75, + KeySequence = 76, + Pen = 77, + TextLength = 78, + TextFormat = 79, + Matrix = 80, + Transform = 81, + LastGuiType = Transform, + + UserType = 127, + + LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type + } + +// Functions + + private template getMetaId() + { + const char[] getMetaId = " + int i = qtd_MetatypeId(toStringz(name)); + if(i <= 0) + i = qRegisterMetaType!(T)(name);"; + } + + static public QVariant fromValue(T)(T obj) + { + QVariant var; + static if (is(T == class) || is(T == interface)) + { + string name = obj.classinfo.name; + mixin(getMetaId!()); + var = new QVariant(i, cast(void*)(obj)); + } + else static if (isDynamicArrayType!(T) || isStaticArrayType!(T) ) + { + string name = typeid(ElementTypeOfArray!(T)).toString ~ "[]"; + mixin(getMetaId!()); + auto darray = new DArrayToC; + darray.array = obj.dup; + var = new QVariant(i, cast(void*)(darray)); + } + else + { + string name = typeid(T).toString; + mixin(getMetaId!()); + auto data = new T; + *data = obj; + var = new QVariant(i, cast(void*)(data)); + } + return var; + } + + static public QVariant opCall(T)(T obj) + { + return fromValue(obj); + } + + public this() { + void* __qt_return_value = qtd_QVariant_QVariant(); + super(__qt_return_value); + } + + + public this(QDataStream s) { + void* __qt_return_value = qtd_QVariant_QVariant_QDataStream(s is null ? null : s.nativeId); + super(__qt_return_value); + } + + + public this(Qt.GlobalColor color) { + void* __qt_return_value = qtd_QVariant_QVariant_GlobalColor(color); + super(__qt_return_value); + } + + + public this(bool b) { + void* __qt_return_value = qtd_QVariant_QVariant_bool(b); + super(__qt_return_value); + } + + + public this(QBitArray bitarray) { + void* __qt_return_value = qtd_QVariant_QVariant_QBitArray(bitarray is null ? null : bitarray.nativeId); + super(__qt_return_value); + } + + + public this(QByteArray bytearray) { + void* __qt_return_value = qtd_QVariant_QVariant_QByteArray(bytearray is null ? null : bytearray.nativeId); + super(__qt_return_value); + } + + + public this(QDate date) { + void* __qt_return_value = qtd_QVariant_QVariant_QDate(date is null ? null : date.nativeId); + super(__qt_return_value); + } + + + public this(QDateTime datetime) { + void* __qt_return_value = qtd_QVariant_QVariant_QDateTime(datetime is null ? null : datetime.nativeId); + super(__qt_return_value); + } + + + public this(string str) { + void* __qt_return_value = qtd_QVariant_QVariant_String(str); + super(__qt_return_value); + } + + + public this(QLine line) { + void* __qt_return_value = qtd_QVariant_QVariant_QLine(&line); + super(__qt_return_value); + } + + + public this(QLineF line) { + void* __qt_return_value = qtd_QVariant_QVariant_QLineF(&line); + super(__qt_return_value); + } + + + public this(QLocale locale) { + void* __qt_return_value = qtd_QVariant_QVariant_QLocale(locale is null ? null : locale.nativeId); + super(__qt_return_value); + } + + + public this(QPoint pt) { + void* __qt_return_value = qtd_QVariant_QVariant_QPoint(&pt); + super(__qt_return_value); + } + + + public this(QPointF pt) { + void* __qt_return_value = qtd_QVariant_QVariant_QPointF(&pt); + super(__qt_return_value); + } + + + public this(QRect rect) { + void* __qt_return_value = qtd_QVariant_QVariant_QRect(&rect); + super(__qt_return_value); + } + + + public this(QRectF rect) { + void* __qt_return_value = qtd_QVariant_QVariant_QRectF(&rect); + super(__qt_return_value); + } + + + public this(QRegExp regExp) { + void* __qt_return_value = qtd_QVariant_QVariant_QRegExp(regExp is null ? null : regExp.nativeId); + super(__qt_return_value); + } + + + public this(QSize size) { + void* __qt_return_value = qtd_QVariant_QVariant_QSize(&size); + super(__qt_return_value); + } + + + public this(QSizeF size) { + void* __qt_return_value = qtd_QVariant_QVariant_QSizeF(&size); + super(__qt_return_value); + } + + + public this(QTime time) { + void* __qt_return_value = qtd_QVariant_QVariant_QTime(time is null ? null : time.nativeId); + super(__qt_return_value); + } + + + public this(QUrl url) { + void* __qt_return_value = qtd_QVariant_QVariant_QUrl(url is null ? null : url.nativeId); + super(__qt_return_value); + } + + + public this(QVariant other) { + void* __qt_return_value = qtd_QVariant_QVariant_QVariant(other is null ? null : other.nativeId); + super(__qt_return_value); + } + +/* + public this(char* str) { + void* __qt_return_value = qtd_QVariant_QVariant_nativepointerchar(str); + super(__qt_return_value); + } +*/ + + public this(double d) { + void* __qt_return_value = qtd_QVariant_QVariant_double(d); + super(__qt_return_value); + } + + + public this(int i) { + void* __qt_return_value = qtd_QVariant_QVariant_int(i); + super(__qt_return_value); + } + + + public this(int typeOrUserType, void* copy) { + void* __qt_return_value = qtd_QVariant_QVariant_int_nativepointervoid(typeOrUserType, copy); + super(__qt_return_value); + } + + + public this(long ll) { + void* __qt_return_value = qtd_QVariant_QVariant_long(ll); + super(__qt_return_value); + } + + + public this(uint ui) { + void* __qt_return_value = qtd_QVariant_QVariant_uint(ui); + super(__qt_return_value); + } + + + public this(ulong ull) { + void* __qt_return_value = qtd_QVariant_QVariant_ulong(ull); + super(__qt_return_value); + } + + private final bool canConvertImpl(string name) + { + int i = qtd_MetatypeId(toStringz(name)); + assert(i > 0); + return qtd_QVariant_canConvert(nativeId, i); + } + + public final bool canConvert(Type)() { + static if ( is(Type == QBitArray) ) + return canConvertImpl("QBitArray"); + else static if ( is(Type == bool) ) + return canConvertImpl("bool"); + else static if ( is(Type == QByteArray) ) + return canConvertImpl("QByteArray"); + else static if ( is(Type == QDate) ) + return canConvertImpl("QDate"); + else static if ( is(Type == QDateTime) ) + return canConvertImpl("QDateTime"); + else static if ( is(Type == double) ) + return canConvertImpl("double"); + else static if ( is(Type == int) ) + return canConvertImpl("int"); + else static if ( is(Type == QLine) ) + return canConvertImpl("QLine"); + else static if ( is(Type == QLineF) ) + return canConvertImpl("QLineF"); + else static if ( is(Type == QLocale) ) + return canConvertImpl("QLocale"); + else static if ( is(Type == long) ) + return canConvertImpl("long"); + else static if ( is(Type == QPoint) ) + return canConvertImpl("QPoint"); + else static if ( is(Type == QPointF) ) + return canConvertImpl("QPointF"); + else static if ( is(Type == QRect) ) + return canConvertImpl("QRect"); + else static if ( is(Type == QRectF) ) + return canConvertImpl("QRectF"); + else static if ( is(Type == QRegExp) ) + return canConvertImpl("QRegExp"); + else static if ( is(Type == QSize) ) + return canConvertImpl("QSize"); + else static if ( is(Type == QSizeF) ) + return canConvertImpl("QSizeF"); + else static if ( is(Type == string) ) + return canConvertImpl("QString"); + else static if ( is(Type == QTime) ) + return canConvertImpl("QTime"); + else static if ( is(Type == uint) ) + return canConvertImpl("unsigned int"); // TODO: + else static if ( is(Type == ulong) ) + return canConvertImpl("unsigned long long"); // TODO: + else static if ( is(Type == QUrl) ) + return canConvertImpl("QUrl"); + else + { + static if( is( Type == class ) || is( Type == interface ) ) + { + Object object = cast(Object)qtd_QVariant_data(nativeId); + if(object) + return cast(Type)(object) !is null; + return false; + } + else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) + { + auto array = cast(DArrayToC*)qtd_QVariant_data(nativeId); + return cast(Type)(array.array) !is null; + } + else + { + int i = qtd_MetatypeId(toStringz(typeid(Type).toString)); + return qtd_QVariant_canConvert(nativeId, i); + } + } + } + + public final Type value(Type)() { + static if ( is(Type == QBitArray) ) + return toBitArra; + else static if ( is(Type == bool) ) + return toBool; + else static if ( is(Type == QByteArray) ) + return toByteArray; + else static if ( is(Type == QDate) ) + return toDate; + else static if ( is(Type == QDateTime) ) + return toDateTime; + else static if ( is(Type == double) ) + return toDouble; + else static if ( is(Type == int) ) + return toInt; + else static if ( is(Type == QLine) ) + return toLine; + else static if ( is(Type == QLineF) ) + return toLineF; + else static if ( is(Type == QLocale) ) + return toLocale; + else static if ( is(Type == long) ) + return toLongLong; + else static if ( is(Type == QPoint) ) + return toPoint; + else static if ( is(Type == QPointF) ) + return toPointF; + else static if ( is(Type == QRect) ) + return toRect; + else static if ( is(Type == QRectF) ) + return toRectF; + else static if ( is(Type == QRegExp) ) + return toRegExp; + else static if ( is(Type == QSize) ) + return toSize; + else static if ( is(Type == QSizeF) ) + return toSizeF; + else static if ( is(Type == string) ) + return toString; + else static if ( is(Type == QTime) ) + return toTime; + else static if ( is(Type == uint) ) + return toUInt; + else static if ( is(Type == ulong) ) + return toULongLong; + else static if ( is(Type == QUrl) ) + return toUrl; + else static if( is( Type == class ) || is( Type == interface ) ) + { + Object object = cast(Object)qtd_QVariant_data(nativeId); + if(object) + return cast(Type)(object); + return null; + } + else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) + { + auto array = cast(DArrayToC*)qtd_QVariant_data(nativeId); + return cast(Type)(array.array); + } + else + { + return *cast(Type*)qtd_QVariant_data(nativeId); + } + } + + public final void clear() { + qtd_QVariant_clear(nativeId); + } + + protected final bool cmp(QVariant other) { + return qtd_QVariant_cmp_QVariant(nativeId, other is null ? null : other.nativeId); + } + + protected final void create(int type, void* copy) { + qtd_QVariant_create_int_nativepointervoid(nativeId, type, copy); + } + + public final bool isNull() { + return qtd_QVariant_isNull(nativeId); + } + + public final bool isValid() { + return qtd_QVariant_isValid(nativeId); + } + + public final void load(QDataStream ds) { + qtd_QVariant_load_QDataStream(nativeId, ds is null ? null : ds.nativeId); + } + + public final void writeTo(QDataStream s) { + qtd_QVariant_writeTo_QDataStream(nativeId, s is null ? null : s.nativeId); + } + + public final QVariant operator_assign(QVariant other) { + void* __qt_return_value = qtd_QVariant_operator_assign_QVariant(nativeId, other is null ? null : other.nativeId); + return new QVariant(__qt_return_value, true); + } + + private final bool operator_equal(QVariant v) { + return qtd_QVariant_operator_equal_QVariant(nativeId, v is null ? null : v.nativeId); + } + + public final void readFrom(QDataStream s) { + qtd_QVariant_readFrom_QDataStream(nativeId, s is null ? null : s.nativeId); + } + + public final void save(QDataStream ds) { + qtd_QVariant_save_QDataStream(nativeId, ds is null ? null : ds.nativeId); + } + + public final QBitArray toBitArray() { + void* __qt_return_value = qtd_QVariant_toBitArray(nativeId); + return new QBitArray(__qt_return_value, false); + } + + public final bool toBool() { + return qtd_QVariant_toBool(nativeId); + } + + public final QByteArray toByteArray() { + void* __qt_return_value = qtd_QVariant_toByteArray(nativeId); + return new QByteArray(__qt_return_value, false); + } + + public final QDate toDate() { + void* __qt_return_value = qtd_QVariant_toDate(nativeId); + return new QDate(__qt_return_value, false); + } + + public final QDateTime toDateTime() { + void* __qt_return_value = qtd_QVariant_toDateTime(nativeId); + return new QDateTime(__qt_return_value, false); + } + + public final double toDouble(bool* ok = null) { + return qtd_QVariant_toDouble_nativepointerbool(nativeId, ok); + } + + public final int toInt(bool* ok = null) { + return qtd_QVariant_toInt_nativepointerbool(nativeId, ok); + } + + public final QLine toLine() { + return qtd_QVariant_toLine(nativeId); + } + + public final QLineF toLineF() { + return qtd_QVariant_toLineF(nativeId); + } + + public final QLocale toLocale() { + void* __qt_return_value = qtd_QVariant_toLocale(nativeId); + return new QLocale(__qt_return_value, false); + } + + public final long toLongLong(bool* ok = null) { + return qtd_QVariant_toLongLong_nativepointerbool(nativeId, ok); + } + + public final QPoint toPoint() { + return qtd_QVariant_toPoint(nativeId); + } + + public final QPointF toPointF() { + return qtd_QVariant_toPointF(nativeId); + } + + public final QRect toRect() { + return qtd_QVariant_toRect(nativeId); + } + + public final QRectF toRectF() { + return qtd_QVariant_toRectF(nativeId); + } + + public final QRegExp toRegExp() { + void* __qt_return_value = qtd_QVariant_toRegExp(nativeId); + return new QRegExp(__qt_return_value, false); + } + + public final QSize toSize() { + return qtd_QVariant_toSize(nativeId); + } + + public final QSizeF toSizeF() { + return qtd_QVariant_toSizeF(nativeId); + } + + public final string toString() { + string res; + qtd_QVariant_toString(nativeId, &res); + return res; + } + + public final QTime toTime() { + void* __qt_return_value = qtd_QVariant_toTime(nativeId); + return new QTime(__qt_return_value, false); + } + + public final uint toUInt(bool* ok = null) { + return qtd_QVariant_toUInt_nativepointerbool(nativeId, ok); + } + + public final ulong toULongLong(bool* ok = null) { + return qtd_QVariant_toULongLong_nativepointerbool(nativeId, ok); + } + + public final QUrl toUrl() { + void* __qt_return_value = qtd_QVariant_toUrl(nativeId); + return new QUrl(__qt_return_value, false); + } + + public final char* typeName() { + return qtd_QVariant_typeName(nativeId); + } + + public final Type type() { + return cast(Type)qtd_QVariant_type(nativeId); + } + + public final int userType() { + return qtd_QVariant_userType(nativeId); + } +// Field accessors + + public this(void* native_id, bool no_real_delete = false) { + super(native_id, no_real_delete); + } + + + ~this() { + if(!__no_real_delete) + __free_native_resources(); + } + + protected void __free_native_resources() { + qtd_QVariant_destructor(nativeId()); + } + +// Injected code in class +} +extern (C) void qtd_QVariant_destructor(void *ptr); + + +// C wrappers +private extern(C) void* qtd_QVariant_QVariant(); +private extern(C) void* qtd_QVariant_QVariant_QDataStream(void* s0); +private extern(C) void* qtd_QVariant_QVariant_GlobalColor(int color0); +private extern(C) void* qtd_QVariant_QVariant_bool(bool b0); +private extern(C) void* qtd_QVariant_QVariant_QBitArray(void* bitarray0); +private extern(C) void* qtd_QVariant_QVariant_QByteArray(void* bytearray0); +private extern(C) void* qtd_QVariant_QVariant_QDate(void* date0); +private extern(C) void* qtd_QVariant_QVariant_QDateTime(void* datetime0); +private extern(C) void* qtd_QVariant_QVariant_String(string string0); +private extern(C) void* qtd_QVariant_QVariant_QLine(void* line0); +private extern(C) void* qtd_QVariant_QVariant_QLineF(void* line0); +private extern(C) void* qtd_QVariant_QVariant_QLocale(void* locale0); +private extern(C) void* qtd_QVariant_QVariant_QPoint(void* pt0); +private extern(C) void* qtd_QVariant_QVariant_QPointF(void* pt0); +private extern(C) void* qtd_QVariant_QVariant_QRect(void* rect0); +private extern(C) void* qtd_QVariant_QVariant_QRectF(void* rect0); +private extern(C) void* qtd_QVariant_QVariant_QRegExp(void* regExp0); +private extern(C) void* qtd_QVariant_QVariant_QSize(void* size0); +private extern(C) void* qtd_QVariant_QVariant_QSizeF(void* size0); +private extern(C) void* qtd_QVariant_QVariant_QTime(void* time0); +private extern(C) void* qtd_QVariant_QVariant_QUrl(void* url0); +private extern(C) void* qtd_QVariant_QVariant_QVariant(void* other0); +private extern(C) void* qtd_QVariant_QVariant_nativepointerchar(char* str0); +private extern(C) void* qtd_QVariant_QVariant_double(double d0); +private extern(C) void* qtd_QVariant_QVariant_int(int i0); +private extern(C) void* qtd_QVariant_QVariant_int_nativepointervoid(int typeOrUserType0, + void* copy1); +private extern(C) void* qtd_QVariant_QVariant_long(long ll0); +private extern(C) void* qtd_QVariant_QVariant_uint(uint ui0); +private extern(C) void* qtd_QVariant_QVariant_ulong(ulong ull0); +private extern(C) bool qtd_QVariant_canConvert(void* __this_nativeId, int); +private extern(C) void qtd_QVariant_clear(void* __this_nativeId); +private extern(C) bool qtd_QVariant_cmp_QVariant(void* __this_nativeId, + void* other0); +private extern(C) void qtd_QVariant_create_int_nativepointervoid(void* __this_nativeId, + int type0, + void* copy1); +private extern(C) bool qtd_QVariant_isNull(void* __this_nativeId); +private extern(C) bool qtd_QVariant_isValid(void* __this_nativeId); +private extern(C) void qtd_QVariant_load_QDataStream(void* __this_nativeId, + void* ds0); +private extern(C) void qtd_QVariant_writeTo_QDataStream(void* __this_nativeId, + void* s0); +private extern(C) void* qtd_QVariant_operator_assign_QVariant(void* __this_nativeId, + void* other0); +private extern(C) bool qtd_QVariant_operator_equal_QVariant(void* __this_nativeId, + void* v0); +private extern(C) void qtd_QVariant_readFrom_QDataStream(void* __this_nativeId, + void* s0); +private extern(C) void qtd_QVariant_save_QDataStream(void* __this_nativeId, + void* ds0); +private extern(C) void* qtd_QVariant_toBitArray(void* __this_nativeId); +private extern(C) bool qtd_QVariant_toBool(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toByteArray(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toDate(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toDateTime(void* __this_nativeId); +private extern(C) double qtd_QVariant_toDouble_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) int qtd_QVariant_toInt_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) QLine qtd_QVariant_toLine(void* __this_nativeId); +private extern(C) QLineF qtd_QVariant_toLineF(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toLocale(void* __this_nativeId); +private extern(C) long qtd_QVariant_toLongLong_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) QPoint qtd_QVariant_toPoint(void* __this_nativeId); +private extern(C) QPointF qtd_QVariant_toPointF(void* __this_nativeId); +private extern(C) QRect qtd_QVariant_toRect(void* __this_nativeId); +private extern(C) QRectF qtd_QVariant_toRectF(void* __this_nativeId); +private extern(C) void* qtd_QVariant_toRegExp(void* __this_nativeId); +private extern(C) QSize qtd_QVariant_toSize(void* __this_nativeId); +private extern(C) QSizeF qtd_QVariant_toSizeF(void* __this_nativeId); +private extern(C) void qtd_QVariant_toString(void* __this_nativeId, + void* __java_return_value); +private extern(C) void* qtd_QVariant_toTime(void* __this_nativeId); +private extern(C) uint qtd_QVariant_toUInt_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) ulong qtd_QVariant_toULongLong_nativepointerbool(void* __this_nativeId, + bool* ok0); +private extern(C) void* qtd_QVariant_toUrl(void* __this_nativeId); +private extern(C) char* qtd_QVariant_typeName(void* __this_nativeId); +private extern(C) int qtd_QVariant_type(void* __this_nativeId); +private extern(C) int qtd_QVariant_userType(void* __this_nativeId); +private extern(C) void *qtd_QVariant_data(void* __this_nativeId); + +// Just the private functions for abstract functions implemeneted in superclasses + +// Virtual Dispatch functions diff -r 34fe79a9915b -r 7dd099050621 qt/d2/qt/qtd/Str.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt/d2/qt/qtd/Str.d Sun Jul 12 18:58:03 2009 +0000 @@ -0,0 +1,73 @@ +/** + * + * Copyright: Copyright QtD Team, 2008-2009 + * License: Boost License 1.0 - * - * Copyright QtD Team, 2008-2009 - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - */ - -module qt.qtd.Str; - -version (Tango) -{ - import tango.text.convert.Utf : toString; - alias char[] string; -} -else -{ - import std.utf : toString = toUTF8; -} - -public static char** toStringzArray(char[][] args) -{ - if ( args is null ) - { - return null; - } - char** argv = (new char*[args.length]).ptr; - int argc = 0; - foreach (char[] p; args) - { - argv[argc++] = cast(char*)(p.dup~'\0'); - } - argv[argc] = null; - - return argv; -} -version(Windows) -{ - export extern(C) void _d_toUtf8(wchar* arr, uint size, string* str) - { - *str = toString(arr[0..size]); - } -} -else -{ - extern(C) void _d_toUtf8(wchar* arr, uint size, string* str) - { - *str = toString(arr[0..size]); - } -} - -