# HG changeset patch
# User eldar
# Date 1242506864 0
# Node ID 5917a613d1181457469b08726b982ce1e37cba08
# Parent 17cc45b326863805173cab4e10bebe08baeb5483
wrapping of QtXml
diff -r 17cc45b32686 -r 5917a613d118 CMakeLists.txt
--- a/CMakeLists.txt Sat May 16 18:06:25 2009 +0000
+++ b/CMakeLists.txt Sat May 16 20:47:44 2009 +0000
@@ -12,7 +12,7 @@
option(BUILD_EXAMPLES "Build examples" "ON")
option(GENERATE_DI_FILES "Generate *.di files with DC -H command" "OFF")
-set(all_packages Core Gui OpenGL) ## TODO: Loading.
+set(all_packages Core Xml) ## TODO: Loading.
## Strip utility.
diff -r 17cc45b32686 -r 5917a613d118 Makefile
--- a/Makefile Sat May 16 18:06:25 2009 +0000
+++ b/Makefile Sat May 16 20:47:44 2009 +0000
@@ -53,7 +53,7 @@
NAME_PREFIX = qtd
endif
ifndef $(PACKAGES)
-PACKAGES = core gui opengl
+PACKAGES = core gui opengl xml
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
@@ -135,7 +135,7 @@
cd generator && qmake && $(MAKE)
dgen: make_gen
- cd generator && $(GEN) $(GEN_OPT) --d-target=$(D_TARGET) --output-directory=../ qtjambi_masterinclude.h build_opengl.txt
+ cd generator && $(GEN) $(GEN_OPT) --d-target=$(D_TARGET) --output-directory=../ qtjambi_masterinclude.h build_xml.txt
## DGenerator ## end
mkdir:
diff -r 17cc45b32686 -r 5917a613d118 generator/build_xml.txt
--- a/generator/build_xml.txt Sat May 16 18:06:25 2009 +0000
+++ b/generator/build_xml.txt Sat May 16 20:47:44 2009 +0000
@@ -1,4 +1,6 @@
-
+
+
+
diff -r 17cc45b32686 -r 5917a613d118 generator/containergenerator.cpp
--- a/generator/containergenerator.cpp Sat May 16 18:06:25 2009 +0000
+++ b/generator/containergenerator.cpp Sat May 16 20:47:44 2009 +0000
@@ -232,7 +232,11 @@
void ContainerGenerator::writeHeaderContent(QTextStream &s, AbstractMetaClass *cls)
{
- s << "#include " << endl
+ QString file_upper = "ArrayOps_" + QString(cls->package()).replace(".", "_") + "_h";
+ file_upper = file_upper.toUpper();
+ s << "#ifndef " << file_upper << endl
+ << "#define " << file_upper << endl << endl
+ << "#include " << endl
<< "#include \"qtd_core.h\"" << endl << endl;
foreach (const TypeEntry *te, containerTypes) {
@@ -244,6 +248,8 @@
writeHeaderArrayFunctions(s, typeEntry);
}
}
+
+ s << "#endif // " << file_upper << endl;
}
void ContainerGenerator::setFuncNames(const QString& cls_name)
diff -r 17cc45b32686 -r 5917a613d118 generator/cppimplgenerator.cpp
--- a/generator/cppimplgenerator.cpp Sat May 16 18:06:25 2009 +0000
+++ b/generator/cppimplgenerator.cpp Sat May 16 20:47:44 2009 +0000
@@ -598,6 +598,9 @@
if (java_class->package() == "qt.gui")
s << "#include \"ArrayOps_qt_gui.h\"" << endl;
+ QString pkg_name = QString(java_class->package()).replace(".", "_");
+ s << QString("#include \"ArrayOps_%1.h\"").arg(pkg_name) << endl;
+
s << endl;
writeInterfaceCasts(s, java_class);
@@ -1921,9 +1924,12 @@
if (nativeArgCount > 0)
s << "," << endl << " ";
// if QString argument we have to pass DArrat
- if ((te && te->qualifiedCppName() == "QString") || d_type->isTargetLangString())
- s << "string " << arg_name;
- else if (d_type->isContainer()) {
+ if ((te && te->qualifiedCppName() == "QString") || d_type->isTargetLangString()) {
+ if (d_export)
+ s << "string " << arg_name;
+ else
+ s << "DArray " << arg_name;
+ } else if (d_type->isContainer()) {
const ContainerTypeEntry *cte =
static_cast(te);
if(isLinearContainer(cte))
@@ -3023,11 +3029,17 @@
<< " = new QVariant(" << qt_name << ");" << endl;
} else if (java_type->isTargetLangString()) {
-
-// if (option & BoxedPrimitive)
- s << INDENT << "_d_toUtf8(" << qt_name << ".utf16(), "
- << qt_name << ".size(), " << java_name << ");" << endl;
-
+ if(java_type->typeEntry()->qualifiedCppName() == "QStringRef") {
+ s << INDENT << "const QString *str_ref = " << qt_name << ".string();" << endl
+ << INDENT << "if(str_ref)" << endl
+ << INDENT << " _d_toUtf8(str_ref->utf16(), str_ref->size(), " << java_name << ");" << endl
+ << INDENT << "else {" << endl
+ << INDENT << " QString empty_str;" << endl
+ << INDENT << " _d_toUtf8(empty_str.utf16(), empty_str.size(), " << java_name << ");" << endl
+ << INDENT << "}" << endl;
+ } else {
+ s << INDENT << QString("_d_toUtf8(%1.utf16(), %1.size(), %2);").arg(qt_name, java_name) << endl;
+ }
} else if (java_type->isTargetLangChar()) {
s << INDENT << "jchar " << java_name << " = " << qt_name << ".unicode();" << endl;
@@ -3381,7 +3393,7 @@
{
Indentation indent(INDENT);
if(targ->isTargetLangString())
- s << INDENT << "string __d_element;" << endl
+ s << INDENT << "DArray __d_element;" << endl
<< INDENT << "qtd_get_string_from_array(" << java_name << ", i, &__d_element);" << endl;
else {
s << INDENT;
diff -r 17cc45b32686 -r 5917a613d118 generator/dgenerator.cpp
--- a/generator/dgenerator.cpp Sat May 16 18:06:25 2009 +0000
+++ b/generator/dgenerator.cpp Sat May 16 20:47:44 2009 +0000
@@ -72,7 +72,7 @@
<< "signed short" << "Array" << "GLuint" << "GLenum" << "GLint"
<< "unsigned long" << "ulong" << "long" << "QByteRef"
<< "QStringList" << "QList" << "QVector" << "QPair"
- << "QSet";
+ << "QSet" << "QStringRef";
}
QString DGenerator::fileNameForClass(const AbstractMetaClass *d_class) const
@@ -3238,7 +3238,7 @@
}
}
else
- s << INDENT << "super(__qt_return_value);" << endl;
+ s << INDENT << "this(__qt_return_value);" << endl;
}
s << INDENT << "}" << endl << endl;
diff -r 17cc45b32686 -r 5917a613d118 generator/typesystem_xml-common.xml
--- a/generator/typesystem_xml-common.xml Sat May 16 18:06:25 2009 +0000
+++ b/generator/typesystem_xml-common.xml Sat May 16 20:47:44 2009 +0000
@@ -41,12 +41,17 @@
-
+
+
+
+
+
+
@@ -132,6 +137,9 @@
+
+
+
diff -r 17cc45b32686 -r 5917a613d118 generator/typesystem_xml-java.java
--- a/generator/typesystem_xml-java.java Sat May 16 18:06:25 2009 +0000
+++ b/generator/typesystem_xml-java.java Sat May 16 20:47:44 2009 +0000
@@ -1,37 +1,38 @@
/****************************************************************************
**
-** Copyright (C) 1992-2008 Nokia. All rights reserved.
+** Copyright (C) 1992-2009 Nokia. All rights reserved.
**
** This file is part of Qt Jambi.
**
-** * Commercial Usage
-* Licensees holding valid Qt Commercial licenses may use this file in
-* accordance with the Qt Commercial License Agreement provided with the
-* Software or, alternatively, in accordance with the terms contained in
-* a written agreement between you and Nokia.
-*
-*
-* GNU General Public License Usage
-* Alternatively, this file may be used under the terms of the GNU
-* General Public License versions 2.0 or 3.0 as published by the Free
-* Software Foundation and appearing in the file LICENSE.GPL included in
-* the packaging of this file. Please review the following information
-* to ensure GNU General Public Licensing requirements will be met:
-* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-* http://www.gnu.org/copyleft/gpl.html. In addition, as a special
-* exception, Nokia gives you certain additional rights. These rights
-* are described in the Nokia Qt GPL Exception version 1.2, included in
-* the file GPL_EXCEPTION.txt in this package.
-*
-* Qt for Windows(R) Licensees
-* As a special exception, Nokia, as the sole copyright holder for Qt
-* Designer, grants users of the Qt/Eclipse Integration plug-in the
-* right for the Qt/Eclipse Integration to link to functionality
-* provided by Qt Designer and its related libraries.
-*
-*
-* If you are unsure which license is appropriate for your use, please
-* contact the sales department at qt-sales@nokia.com.
+** Commercial Usage
+Licensees holding valid Qt Commercial licenses may use this file in
+accordance with the Qt Commercial License Agreement provided with the
+Software or, alternatively, in accordance with the terms contained in
+a written agreement between you and Nokia.
+
+GNU Lesser General Public License Usage
+Alternatively, this file may be used under the terms of the GNU Lesser
+General Public License version 2.1 as published by the Free Software
+Foundation and appearing in the file LICENSE.LGPL included in the
+packaging of this file. Please review the following information to
+ensure the GNU Lesser General Public License version 2.1 requirements
+will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+
+In addition, as a special exception, Nokia gives you certain
+additional rights. These rights are described in the Nokia Qt LGPL
+Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+package.
+
+GNU General Public License Usage
+Alternatively, this file may be used under the terms of the GNU
+General Public License version 3.0 as published by the Free Software
+Foundation and appearing in the file LICENSE.GPL included in the
+packaging of this file. Please review the following information to
+ensure the GNU General Public License version 3.0 requirements will be
+met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please
+contact the sales department at qt-sales@nokia.com.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
@@ -41,8 +42,8 @@
package generator;
-import qt.*;
-import qt.xml.*;
+import com.trolltech.qt.*;
+import com.trolltech.qt.xml.*;
class QDomDocument___ extends QDomDocument {
@@ -61,6 +62,17 @@
}
+ public final Result setContent(QXmlInputSource source, boolean namespaceProcessing)
+ {
+ QNativePointer errorStr = new QNativePointer(QNativePointer.Type.String);
+ QNativePointer errorLine = new QNativePointer(QNativePointer.Type.Int);
+ QNativePointer errorColumn = new QNativePointer(QNativePointer.Type.Int);
+
+ boolean success = setContent(source, namespaceProcessing, errorStr, errorLine, errorColumn);
+
+ return new Result(success, errorStr, errorLine, errorColumn);
+ }
+
}// class
class QXmlNamespaceSupport___ extends QXmlNamespaceSupport {
@@ -105,7 +117,7 @@
class QXmlStreamWriter___ extends QXmlStreamWriter {
- public QXmlStreamWriter(qt.core.QByteArray array) {
+ public QXmlStreamWriter(com.trolltech.qt.core.QByteArray array) {
this(array.nativePointer());
__rcDevice = array;
}
@@ -134,3 +146,5 @@
}
}// class
+
+
diff -r 17cc45b32686 -r 5917a613d118 generator/typesystem_xml-java.xml
--- a/generator/typesystem_xml-java.xml Sat May 16 18:06:25 2009 +0000
+++ b/generator/typesystem_xml-java.xml Sat May 16 20:47:44 2009 +0000
@@ -1,7 +1,7 @@
-
+
- qt.Utilities.loadQtLibrary("QtXml");
+ com.trolltech.qt.Utilities.loadQtLibrary("QtXml");
@@ -10,9 +10,9 @@
-
-
-
+
+
+
@@ -28,6 +28,20 @@
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -174,7 +188,7 @@
-
+
@@ -329,7 +343,7 @@
-
+
jobject %out = qtjambi_to_resolvedentity(__jni_env, %in, inputSourceHolder);
diff -r 17cc45b32686 -r 5917a613d118 generator/typesystem_xml.xml
--- a/generator/typesystem_xml.xml Sat May 16 18:06:25 2009 +0000
+++ b/generator/typesystem_xml.xml Sat May 16 20:47:44 2009 +0000
@@ -1,9 +1,9 @@
-
+
- qt.Utilities.loadQtLibrary("QtXml");
+ com.trolltech.qt.Utilities.loadQtLibrary("QtXml");
@@ -55,12 +55,17 @@
-
+
+
+
+
+
+
@@ -68,16 +73,10 @@
-
+
-
+
-
+
-
+
@@ -306,6 +319,9 @@
+
+
+
@@ -330,7 +346,7 @@
-
+
@@ -381,7 +394,7 @@
-
+
@@ -448,7 +461,7 @@
-
+
@@ -547,7 +560,7 @@
-
+
diff -r 17cc45b32686 -r 5917a613d118 include/ArrayOpsPrimitive.h
--- a/include/ArrayOpsPrimitive.h Sat May 16 18:06:25 2009 +0000
+++ b/include/ArrayOpsPrimitive.h Sat May 16 20:47:44 2009 +0000
@@ -33,7 +33,7 @@
QTD_EXPORT(void, qtd_allocate_string_array, (void* arr, size_t len))
QTD_EXPORT(void, qtd_assign_string_array_element, (void* arr, size_t pos, void* elem))
QTD_EXPORT(void*, qtd_string_from_array, (void* arr, size_t pos))
-QTD_EXPORT(void, qtd_get_string_from_array, (void* arr, size_t pos, string* elem))
+QTD_EXPORT(void, qtd_get_string_from_array, (void* arr, size_t pos, DArray* elem))
#ifdef CPP_SHARED
diff -r 17cc45b32686 -r 5917a613d118 include/qtd_core.h
--- a/include/qtd_core.h Sat May 16 18:06:25 2009 +0000
+++ b/include/qtd_core.h Sat May 16 20:47:44 2009 +0000
@@ -46,7 +46,6 @@
void* ptr;
};
-#define string DArray
#define Array DArray
#ifdef CPP_SHARED