diff options
Diffstat (limited to 'tools/designer/data')
-rw-r--r-- | tools/designer/data/generate_header.xsl | 465 | ||||
-rw-r--r-- | tools/designer/data/generate_impl.xsl | 1161 | ||||
-rw-r--r-- | tools/designer/data/generate_shared.xsl | 331 | ||||
-rw-r--r-- | tools/designer/data/ui3.xsd | 353 | ||||
-rw-r--r-- | tools/designer/data/ui4.xsd | 574 |
5 files changed, 2884 insertions, 0 deletions
diff --git a/tools/designer/data/generate_header.xsl b/tools/designer/data/generate_header.xsl new file mode 100644 index 0000000..e3dae9e --- /dev/null +++ b/tools/designer/data/generate_header.xsl @@ -0,0 +1,465 @@ +<!DOCTYPE xsl:stylesheet [ + <!ENTITY endl " "> +]> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xsl:output method="text"/> + + <xsl:include href="generate_shared.xsl"/> + +<!-- Forward declaration --> + + <xsl:template name="class-forward-declaration"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/attribute::name)"/> + + <xsl:text>class </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>;&endl;</xsl:text> + </xsl:template> + +<!-- Class declaration: child element accessors --> + + <xsl:template name="child-element-accessors"> + <xsl:param name="node"/> + + <xsl:variable name="isChoice" select="name($node)='xs:choice'"/> + + <xsl:if test="$isChoice"> + <xsl:text> enum Kind { Unknown = 0</xsl:text> + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:text>, </xsl:text> + <xsl:value-of select="$cap-name"/> + </xsl:for-each> + <xsl:text> };&endl;</xsl:text> + <xsl:text> inline Kind kind() const { return m_kind; }&endl;&endl;</xsl:text> + </xsl:if> + + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="array" select="@maxOccurs='unbounded'"/> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="return-cpp-type"> + <xsl:call-template name="xs-type-to-cpp-return-type"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="$array"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="argument-cpp-type"> + <xsl:call-template name="xs-type-to-cpp-argument-type"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="$array"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="xs-type-cat"> + <xsl:call-template name="xs-type-category"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="$array"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> inline </xsl:text> + <xsl:value-of select="$return-cpp-type"/> + <xsl:text> element</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>() const { return m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>; }&endl;</xsl:text> + + <xsl:if test="$xs-type-cat = 'pointer'"> + <xsl:text> </xsl:text> + <xsl:value-of select="$return-cpp-type"/> + <xsl:text> takeElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>();&endl;</xsl:text> + </xsl:if> + + <xsl:text> void setElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(</xsl:text> + <xsl:value-of select="$argument-cpp-type"/> + <xsl:text> a);&endl;</xsl:text> + + <xsl:if test="not($isChoice) and not(@maxOccurs='unbounded')"> + <xsl:text> inline bool hasElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>() const { return m_children & </xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>; }&endl;</xsl:text> + <xsl:text> void clearElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>();&endl;</xsl:text> + </xsl:if> + <xsl:text>&endl;</xsl:text> + + </xsl:for-each> + </xsl:template> + +<!-- Class declaration: child element data --> + + <xsl:template name="child-element-data"> + <xsl:param name="node"/> + + <xsl:variable name="isChoice" select="$node[name()='xs:choice']"/> + + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cpp-type"> + <xsl:call-template name="xs-type-to-cpp-return-type"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="@maxOccurs='unbounded'"/> + </xsl:call-template> + </xsl:variable> + <xsl:text> </xsl:text> + <xsl:value-of select="$cpp-type"/> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>;&endl;</xsl:text> + </xsl:for-each> + + <xsl:if test="not($isChoice) and not(@macOccurs='unbounded')"> + <xsl:text> enum Child {&endl;</xsl:text> + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> </xsl:text> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + <xsl:text> = </xsl:text> + <xsl:call-template name="powers-of-two"> + <xsl:with-param name="num" select="position() - 1"/> + </xsl:call-template> + <xsl:if test="position()!=last()"> + <xsl:text>,</xsl:text> + </xsl:if> + <xsl:text>&endl;</xsl:text> + + </xsl:for-each> + <xsl:text> };&endl;</xsl:text> + </xsl:if> + </xsl:template> + +<!-- Class declaration: attribute accessors --> + + <xsl:template name="attribute-accessors"> + <xsl:param name="node"/> + + <xsl:for-each select="$node/xs:attribute"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cpp-return-type"> + <xsl:call-template name="xs-type-to-cpp-return-type"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cpp-argument-type"> + <xsl:call-template name="xs-type-to-cpp-argument-type"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> inline bool hasAttribute</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>() const { return m_has_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>; }&endl;</xsl:text> + + <xsl:text> inline </xsl:text> + <xsl:value-of select="$cpp-return-type"/> + <xsl:text> attribute</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>() const { return m_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>; }&endl;</xsl:text> + + <xsl:text> inline void setAttribute</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(</xsl:text> + <xsl:value-of select="$cpp-argument-type"/> + <xsl:text> a) { m_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = a; m_has_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = true; }&endl;</xsl:text> + + <xsl:text> inline void clearAttribute</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>() { m_has_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = false; }&endl;&endl;</xsl:text> + </xsl:for-each> + </xsl:template> + +<!-- Class declaration --> + + <xsl:template name="class-declaration"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> +<!-- <xsl:variable name="hasText" select="$node[@mixed='true']"/>--> + <xsl:variable name="hasText" select="true()"/> + + <xsl:text>class QDESIGNER_UILIB_EXPORT </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text> {&endl;</xsl:text> + <xsl:text>public:&endl;</xsl:text> + <xsl:text> </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>();&endl;</xsl:text> + <xsl:text> ~</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>();&endl;&endl;</xsl:text> + + <xsl:text> void read(QXmlStreamReader &reader);&endl;</xsl:text> + <xsl:text>#ifdef QUILOADER_QDOM_READ&endl;</xsl:text> + <xsl:text> void read(const QDomElement &node);&endl;</xsl:text> + <xsl:text>#endif&endl;</xsl:text> + <xsl:text> void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;&endl;</xsl:text> + + <xsl:if test="$hasText"> + <xsl:text> inline QString text() const { return m_text; }&endl;</xsl:text> + <xsl:text> inline void setText(const QString &s) { m_text = s; }&endl;</xsl:text> + </xsl:if> + + <xsl:text>&endl;</xsl:text> + + <xsl:text> // attribute accessors&endl;</xsl:text> + <xsl:call-template name="attribute-accessors"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:text> // child element accessors&endl;</xsl:text> + + <xsl:for-each select="$node/xs:sequence | $node/xs:choice | $node/xs:all"> + <xsl:call-template name="child-element-accessors"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text>private:&endl;</xsl:text> + + <xsl:if test="$hasText"> + <xsl:text> QString m_text;&endl;</xsl:text> + </xsl:if> + + <xsl:text> void clear(bool clear_all = true);&endl;&endl;</xsl:text> + + <xsl:text> // attribute data&endl;</xsl:text> + <xsl:for-each select="$node/xs:attribute"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cpp-type"> + <xsl:call-template name="xs-type-to-cpp-type"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + <xsl:text> </xsl:text> + <xsl:value-of select="$cpp-type"/> + <xsl:text> m_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>;&endl;</xsl:text> + <xsl:text> bool m_has_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>;&endl;&endl;</xsl:text> + </xsl:for-each> + + <xsl:text> // child element data&endl;</xsl:text> + <xsl:if test="boolean($node/xs:choice)"> + <xsl:text> Kind m_kind;&endl;</xsl:text> + </xsl:if> + <xsl:if test="not($node/xs:choice)"> + <!-- TODO: if there are no elements with maxOccurs='1', m_children is never used--> + <xsl:text> uint m_children;&endl;</xsl:text> + </xsl:if> + <xsl:for-each select="$node/xs:sequence | $node/xs:choice | $node/xs:all"> + <xsl:call-template name="child-element-data"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text>&endl;</xsl:text> + <xsl:text> </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>(const </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text> &other);&endl;</xsl:text> + <xsl:text> void operator = (const </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>&other);&endl;</xsl:text> + + <xsl:text>};&endl;&endl;</xsl:text> + </xsl:template> + +<!-- Root --> + + <xsl:template match="xs:schema"> + +<xsl:text>/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +// THIS FILE IS AUTOMATICALLY GENERATED + +#ifndef UI4_H +#define UI4_H + +#include <QtCore/QList> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QXmlStreamReader> +#include <QtCore/QXmlStreamWriter> +#include <QtCore/qglobal.h> + +#if defined(QT_UIC3) + #define QUILOADER_QDOM_READ +#endif + +QT_BEGIN_NAMESPACE + +#ifdef QUILOADER_QDOM_READ + class QDomElement; +#endif + + +#define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT +#define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT + +#if defined(QT_DESIGNER_STATIC) || defined(QT_UIC) || defined(QT_UIC3) +# define QDESIGNER_UILIB_EXPORT +#elif defined(QDESIGNER_UILIB_LIBRARY) +# define QDESIGNER_UILIB_EXPORT QDESIGNER_UILIB_EXTERN +#else +# define QDESIGNER_UILIB_EXPORT QDESIGNER_UILIB_IMPORT +#endif + +#ifndef QDESIGNER_UILIB_EXPORT +# define QDESIGNER_UILIB_EXPORT +#endif + +#ifdef QFORMINTERNAL_NAMESPACE +namespace QFormInternal +{ +#endif + +</xsl:text> + + <xsl:text>&endl;</xsl:text> + <xsl:text>/*******************************************************************************&endl;</xsl:text> + <xsl:text>** Forward declarations&endl;</xsl:text> + <xsl:text>*/&endl;&endl;</xsl:text> + + <xsl:for-each select="xs:complexType"> + <xsl:call-template name="class-forward-declaration"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text>&endl;</xsl:text> + <xsl:text>/*******************************************************************************&endl;</xsl:text> + <xsl:text>** Declarations&endl;</xsl:text> + <xsl:text>*/&endl;&endl;</xsl:text> + + <xsl:for-each select="xs:complexType"> + <xsl:call-template name="class-declaration"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + <xsl:text> +#ifdef QFORMINTERNAL_NAMESPACE +} +#endif + +QT_END_NAMESPACE + +#endif // UI4_H +</xsl:text> + </xsl:template> +</xsl:stylesheet> diff --git a/tools/designer/data/generate_impl.xsl b/tools/designer/data/generate_impl.xsl new file mode 100644 index 0000000..2dfbb15 --- /dev/null +++ b/tools/designer/data/generate_impl.xsl @@ -0,0 +1,1161 @@ +<!DOCTYPE xsl:stylesheet [ + <!ENTITY endl " "> +]> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xsl:output method="text"/> + + <xsl:include href="generate_shared.xsl"/> + +<!-- Implementation: constructor --> + + <xsl:template name="ctor-init-attributes"> + <xsl:param name="node"/> + <xsl:for-each select="$node/xs:attribute"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:text> m_has_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = false;&endl;</xsl:text> + <xsl:choose> + <xsl:when test="@type = 'xs:integer'"> + <xsl:text> m_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = 0;&endl;</xsl:text> + </xsl:when> + <xsl:when test="@type = 'xs:double'"> + <xsl:text> m_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = 0.0;&endl;</xsl:text> + </xsl:when> + <xsl:when test="@type = 'xs:float'"> + <xsl:text> m_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = 0.0;&endl;</xsl:text> + </xsl:when> + <xsl:when test="@type = 'xs:boolean'"> + <xsl:text> m_attr_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = false;&endl;</xsl:text> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + + <xsl:template name="ctor-init-child-elements"> + <xsl:param name="node"/> + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="array" select="@maxOccurs='unbounded'"/> + <xsl:if test="not($array)"> + <xsl:variable name="cpp-type"> + <xsl:call-template name="xs-type-to-cpp-type"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="$array"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="@type = 'xs:integer'"> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = 0;&endl;</xsl:text> + </xsl:when> + <xsl:when test="@type = 'xs:float'"> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = 0.0;&endl;</xsl:text> + </xsl:when> + <xsl:when test="@type = 'xs:boolean'"> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = false;&endl;</xsl:text> + </xsl:when> + <xsl:when test="@type = 'xs:string'"></xsl:when> + <xsl:otherwise> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = 0;&endl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:for-each> + </xsl:template> + + <xsl:template name="ctor-init-members"> + <xsl:param name="node"/> + + <xsl:if test="boolean($node/xs:choice)"> + <xsl:text> m_kind = Unknown;&endl;&endl;</xsl:text> + </xsl:if> + + <xsl:if test="not($node/xs:choice)"> + <xsl:text> m_children = 0;&endl;</xsl:text> + </xsl:if> + + <xsl:call-template name="ctor-init-attributes"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + + <xsl:if test="$node[@mixed='true']"> + <xsl:text> m_text = QLatin1String("");&endl;</xsl:text> + </xsl:if> + + <xsl:for-each select="$node//xs:sequence | $node//xs:choice | $node//xs:all"> + <xsl:call-template name="ctor-init-child-elements"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + + <xsl:template name="ctor-impl"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> + + <xsl:value-of select="$name"/> + <xsl:text>::</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>()&endl;</xsl:text> + <xsl:text>{&endl;</xsl:text> + <xsl:call-template name="ctor-init-members"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + <xsl:text>}&endl;&endl;</xsl:text> + </xsl:template> + +<!-- Implementation: destructor --> + + <xsl:template name="dtor-delete-members"> + <xsl:param name="node"/> + + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="xs-type-cat"> + <xsl:call-template name="xs-type-category"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="@maxOccurs='unbounded'"> + <xsl:if test="$xs-type-cat = 'pointer'"> + <xsl:text> qDeleteAll(m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>);&endl;</xsl:text> + </xsl:if> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>.clear();&endl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$xs-type-cat = 'pointer'"> + <xsl:text> delete m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>;&endl;</xsl:text> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template> + + <xsl:template name="dtor-impl"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> + + <xsl:value-of select="$name"/> + <xsl:text>::~</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>()&endl;</xsl:text> + <xsl:text>{&endl;</xsl:text> + + <xsl:for-each select="$node//xs:sequence | $node//xs:choice | $node//xs:all"> + <xsl:call-template name="dtor-delete-members"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text>}&endl;&endl;</xsl:text> + </xsl:template> + +<!-- Implementation: clear() --> + + <xsl:template name="clear-impl"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> + + <xsl:text>void </xsl:text><xsl:value-of select="$name"/> + <xsl:text>::clear(bool clear_all)&endl;</xsl:text> + <xsl:text>{&endl;</xsl:text> + + <xsl:for-each select="$node//xs:sequence | $node//xs:choice | $node//xs:all"> + <xsl:call-template name="dtor-delete-members"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text>&endl; if (clear_all) {&endl;</xsl:text> + + <xsl:choose> + <xsl:when test="$node[@mixed='true']"> + <xsl:text> m_text = QLatin1String("");&endl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> m_text.clear();&endl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + + <xsl:call-template name="ctor-init-attributes"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + <xsl:text> }&endl;&endl;</xsl:text> + + <xsl:if test="boolean($node/xs:choice)"> + <xsl:text> m_kind = Unknown;&endl;&endl;</xsl:text> + </xsl:if> + + <xsl:if test="not($node/xs:choice)"> + <xsl:text> m_children = 0;&endl;</xsl:text> + </xsl:if> + + <xsl:for-each select="$node//xs:sequence | $node//xs:choice | $node//xs:all"> + <xsl:call-template name="ctor-init-child-elements"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text>}&endl;&endl;</xsl:text> + + </xsl:template> + + <!-- Format a string constant as QString(QLatin1Char('X')) or QLatin1String("foo"), respectively --> + <xsl:template name="string-constant"> + <xsl:param name="literal"/> + <xsl:choose> + <xsl:when test="string-length($literal) < 2"> + <xsl:text>QString(QLatin1Char('</xsl:text> + <xsl:value-of select="$literal"/> + <xsl:text>'))</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>QLatin1String("</xsl:text> + <xsl:value-of select="$literal"/> + <xsl:text>")</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +<!-- Implementation: read(QXmlStreamReader) --> + + <xsl:template name="read-impl-load-attributes"> + <xsl:param name="node"/> + + <xsl:if test="$node/xs:attribute"> + <xsl:text>&endl;</xsl:text> + <xsl:text> foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {&endl;</xsl:text> + <xsl:text> QStringRef name = attribute.name();&endl;</xsl:text> + + <xsl:for-each select="$node/xs:attribute"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-from-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val"> + <xsl:text>attribute.value().toString()</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:text> if (name == </xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="@name"/> + </xsl:call-template> + <xsl:text>) {&endl;</xsl:text> + <xsl:text> setAttribute</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(</xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + <xsl:text> continue;&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + </xsl:for-each> + + <xsl:text> reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template name="read-impl-load-child-element"> + <xsl:param name="node"/> + + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="xs-type-cat"> + <xsl:call-template name="xs-type-category"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="lower-name"> + <xsl:call-template name="lower-text"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="array" select="@maxOccurs = 'unbounded'"/> + + <xsl:text> if (tag == </xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$lower-name"/> + </xsl:call-template> + <xsl:text>) {&endl;</xsl:text> + + <xsl:choose> + <xsl:when test="not($array) and $xs-type-cat = 'value'"> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-from-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val" select="'reader.readElementText()'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> setElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(</xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + </xsl:when> + <xsl:when test="@maxOccurs='unbounded' and $xs-type-cat = 'value'"> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-from-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val" select="'reader.readElementText()'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>.append(</xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + </xsl:when> + <xsl:when test="not(@maxOccurs='unbounded') and $xs-type-cat = 'pointer'"> + <xsl:text> Dom</xsl:text> + <xsl:value-of select="@type"/> + <xsl:text> *v = new Dom</xsl:text> + <xsl:value-of select="@type"/> + <xsl:text>();&endl;</xsl:text> + <xsl:text> v->read(reader);&endl;</xsl:text> + <xsl:text> setElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(v);&endl;</xsl:text> + </xsl:when> + <xsl:when test="@maxOccurs='unbounded' and $xs-type-cat = 'pointer'"> + <xsl:text> Dom</xsl:text> + <xsl:value-of select="@type"/> + <xsl:text> *v = new Dom</xsl:text> + <xsl:value-of select="@type"/> + <xsl:text>();&endl;</xsl:text> + <xsl:text> v->read(reader);&endl;</xsl:text> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>.append(v);&endl;</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:text> continue;&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + </xsl:for-each> + </xsl:template> + + <xsl:template name="read-impl"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> + + <xsl:text>void </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>::read(QXmlStreamReader &reader)&endl;</xsl:text> + + <xsl:text>{&endl;</xsl:text> + + <xsl:call-template name="read-impl-load-attributes"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:text>&endl;</xsl:text> + + <xsl:text> for (bool finished = false; !finished && !reader.hasError();) {&endl;</xsl:text> + <xsl:text> switch (reader.readNext()) {&endl;</xsl:text> + <xsl:text> case QXmlStreamReader::StartElement : {&endl;</xsl:text> + <xsl:text> const QString tag = reader.name().toString().toLower();&endl;</xsl:text> + + <xsl:for-each select="$node//xs:sequence | $node//xs:choice | $node//xs:all"> + <xsl:call-template name="read-impl-load-child-element"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text> reader.raiseError(QLatin1String("Unexpected element ") + tag);&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + <xsl:text> break;&endl;</xsl:text> + <xsl:text> case QXmlStreamReader::EndElement :&endl;</xsl:text> + <xsl:text> finished = true;&endl;</xsl:text> + <xsl:text> break;&endl;</xsl:text> + <xsl:text> case QXmlStreamReader::Characters :&endl;</xsl:text> + <xsl:text> if (!reader.isWhitespace())&endl;</xsl:text> + <xsl:text> m_text.append(reader.text().toString());&endl;</xsl:text> + <xsl:text> break;&endl;</xsl:text> + <xsl:text> default :&endl;</xsl:text> + <xsl:text> break;&endl;</xsl:text> + + <xsl:text> }&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + <xsl:text>}&endl;&endl;</xsl:text> + </xsl:template> + +<!-- Implementation: read(QDomElement) --> + + <xsl:template name="read-impl-qdom-load-attributes"> + <xsl:param name="node"/> + + <xsl:if test="$node/xs:attribute"> + <xsl:text>&endl;</xsl:text> + + <xsl:for-each select="$node/xs:attribute"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-from-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val"> + <xsl:text>node.attribute(</xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="@name"/> + </xsl:call-template> + <xsl:text>)</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:text> if (node.hasAttribute(</xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="@name"/> + </xsl:call-template> + <xsl:text>))&endl;</xsl:text> + <xsl:text> setAttribute</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(</xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + </xsl:for-each> + </xsl:if> + </xsl:template> + + <xsl:template name="read-impl-qdom-load-child-element"> + <xsl:param name="node"/> + + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="xs-type-cat"> + <xsl:call-template name="xs-type-category"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="lower-name"> + <xsl:call-template name="lower-text"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="array" select="@maxOccurs = 'unbounded'"/> + + <xsl:text> if (tag == </xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$lower-name"/> + </xsl:call-template> + <xsl:text>) {&endl;</xsl:text> + + <xsl:choose> + <xsl:when test="not($array) and $xs-type-cat = 'value'"> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-from-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val" select="'e.text()'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> setElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(</xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + </xsl:when> + <xsl:when test="@maxOccurs='unbounded' and $xs-type-cat = 'value'"> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-from-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val" select="'e.text()'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>.append(</xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + </xsl:when> + <xsl:when test="not(@maxOccurs='unbounded') and $xs-type-cat = 'pointer'"> + <xsl:text> Dom</xsl:text> + <xsl:value-of select="@type"/> + <xsl:text> *v = new Dom</xsl:text> + <xsl:value-of select="@type"/> + <xsl:text>();&endl;</xsl:text> + <xsl:text> v->read(e);&endl;</xsl:text> + <xsl:text> setElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(v);&endl;</xsl:text> + </xsl:when> + <xsl:when test="@maxOccurs='unbounded' and $xs-type-cat = 'pointer'"> + <xsl:text> Dom</xsl:text> + <xsl:value-of select="@type"/> + <xsl:text> *v = new Dom</xsl:text> + <xsl:value-of select="@type"/> + <xsl:text>();&endl;</xsl:text> + <xsl:text> v->read(e);&endl;</xsl:text> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>.append(v);&endl;</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:text> continue;&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + </xsl:for-each> + </xsl:template> + + <xsl:template name="read-impl-qdom"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> + + <xsl:text>#ifdef QUILOADER_QDOM_READ&endl;</xsl:text> + + <xsl:text>void </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>::read(const QDomElement &node)&endl;</xsl:text> + + <xsl:text>{</xsl:text> + + <xsl:call-template name="read-impl-qdom-load-attributes"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:text>&endl;</xsl:text> + + <xsl:text> for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {&endl;</xsl:text> + <xsl:text> if (!n.isElement())&endl;</xsl:text> + <xsl:text> continue;&endl;</xsl:text> + <xsl:text> QDomElement e = n.toElement();&endl;</xsl:text> + <xsl:text> QString tag = e.tagName().toLower();&endl;</xsl:text> + + <xsl:for-each select="$node//xs:sequence | $node//xs:choice | $node//xs:all"> + <xsl:call-template name="read-impl-qdom-load-child-element"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text> }&endl;</xsl:text> + + <xsl:choose> + <xsl:when test="$node[@mixed='true']"> + <xsl:text> m_text = QLatin1String("");&endl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> m_text.clear();&endl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + + <xsl:text> for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {&endl;</xsl:text> + <xsl:text> if (child.isText())&endl;</xsl:text> + <xsl:text> m_text.append(child.nodeValue());&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + + <xsl:text>}&endl;</xsl:text> + <xsl:text>#endif&endl;</xsl:text> + <xsl:text>&endl;</xsl:text> + </xsl:template> +<!-- Implementation: write() --> + + <xsl:template name="write-impl-save-attributes"> + <xsl:param name="node"/> + + <xsl:for-each select="$node/xs:attribute"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="lower-name"> + <xsl:call-template name="lower-text"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> if (hasAttribute</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>())&endl;</xsl:text> + <xsl:text> writer.writeAttribute(</xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$lower-name"/> + </xsl:call-template> + + <xsl:text>, </xsl:text> + + <xsl:call-template name="xs-type-to-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val" select="concat('attribute', $cap-name, '()')"/> + </xsl:call-template> + + <xsl:text>);&endl;&endl;</xsl:text> + </xsl:for-each> + </xsl:template> + + <xsl:template name="write-impl-save-choice-child-element"> + <xsl:param name="node"/> + <xsl:variable name="have-kind" select="name($node) = 'xs:choice'"/> + + <xsl:text> switch (kind()) {&endl;</xsl:text> + + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="lower-name"> + <xsl:call-template name="lower-text"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="xs-type-cat"> + <xsl:call-template name="xs-type-category"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> case </xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>: {&endl;</xsl:text> + <xsl:choose> + <xsl:when test="$xs-type-cat = 'value'"> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-to-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val" select="concat('element', $cap-name, '()')"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> writer.writeTextElement(</xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$camel-case-name"/> + </xsl:call-template> + <xsl:text>, </xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + </xsl:when> + <xsl:when test="$xs-type-cat = 'pointer'"> + <xsl:variable name="cpp-return-type"> + <xsl:call-template name="xs-type-to-cpp-return-type"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> </xsl:text> + <xsl:value-of select="$cpp-return-type"/> + <xsl:text> v = element</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>();&endl;</xsl:text> + <xsl:text> if (v != 0) {&endl;</xsl:text> + <xsl:text> v->write(writer, </xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$lower-name"/> + </xsl:call-template> + <xsl:text>);&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:text> break;&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + </xsl:for-each> + + <xsl:text> default:&endl;</xsl:text> + <xsl:text> break;&endl;</xsl:text> + <xsl:text> }&endl;</xsl:text> + </xsl:template> + + <xsl:template name="write-impl-save-sequence-child-element"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="lower-name"> + <xsl:call-template name="lower-text"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="xs-type-cat"> + <xsl:call-template name="xs-type-category"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cpp-return-type"> + <xsl:call-template name="xs-type-to-cpp-return-type"> + <xsl:with-param name="xs-type" select="@type"/> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <xsl:when test="@maxOccurs='unbounded'"> + <xsl:text> for (int i = 0; i < m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>.size(); ++i) {&endl;</xsl:text> + <xsl:text> </xsl:text> + <xsl:value-of select="$cpp-return-type"/> + <xsl:text> v = m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>[i];&endl;</xsl:text> + <xsl:choose> + <xsl:when test="$xs-type-cat = 'pointer'"> + <xsl:text> v->write(writer, </xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$lower-name"/> + </xsl:call-template> + <xsl:text>);&endl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-to-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val" select="'v'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> writer.writeTextElement(</xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$lower-name"/> + </xsl:call-template> + <xsl:text>, </xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> }&endl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> if (m_children & </xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>) {&endl;</xsl:text> + <xsl:choose> + <xsl:when test="$xs-type-cat = 'pointer'"> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>->write(writer, </xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$lower-name"/> + </xsl:call-template> + <xsl:text>);&endl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="qstring-func"> + <xsl:call-template name="xs-type-to-qstring-func"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="val" select="concat('m_', $camel-case-name)"/> + </xsl:call-template> + </xsl:variable> + <xsl:text> writer.writeTextElement(</xsl:text> + <xsl:call-template name="string-constant"> + <xsl:with-param name="literal" select="$lower-name"/> + </xsl:call-template> + <xsl:text>, </xsl:text> + <xsl:value-of select="$qstring-func"/> + <xsl:text>);&endl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> }&endl;&endl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template> + + <xsl:template name="write-impl"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> + <xsl:variable name="lower-name"> + <xsl:call-template name="lower-text"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text>void </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>::write(QXmlStreamWriter &writer, const QString &tagName) const&endl;</xsl:text> + <xsl:text>{&endl;</xsl:text> + + <xsl:text> writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("</xsl:text> + <xsl:value-of select="$lower-name"/> + <xsl:text>") : tagName.toLower());&endl;&endl;</xsl:text> + + <xsl:call-template name="write-impl-save-attributes"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:for-each select="$node//xs:choice"> + <xsl:call-template name="write-impl-save-choice-child-element"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:for-each select="$node//xs:sequence | $node//xs:all"> + <xsl:call-template name="write-impl-save-sequence-child-element"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + + <xsl:text> if (!m_text.isEmpty())&endl;</xsl:text> + <xsl:text> writer.writeCharacters(m_text);&endl;&endl;</xsl:text> + + <xsl:text> writer.writeEndElement();&endl;</xsl:text> + <xsl:text>}&endl;&endl;</xsl:text> + </xsl:template> + +<!-- Implementation: child element setters --> + + <xsl:template name="child-setter-impl-helper"> + <xsl:param name="node"/> + <xsl:param name="name"/> + <xsl:variable name="make-kind-enum" select="name($node)='xs:choice'"/> + <xsl:variable name="isChoice" select="name($node)='xs:choice'"/> + + <xsl:for-each select="$node/xs:element"> + <xsl:variable name="array" select="@maxOccurs = 'unbounded'"/> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="return-cpp-type"> + <xsl:call-template name="xs-type-to-cpp-return-type"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="$array"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="argument-cpp-type"> + <xsl:call-template name="xs-type-to-cpp-argument-type"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="$array"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="xs-type-cat"> + <xsl:call-template name="xs-type-category"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="$array"/> + </xsl:call-template> + </xsl:variable> + + <xsl:if test="$xs-type-cat = 'pointer'"> + <xsl:value-of select="$return-cpp-type"/> + <xsl:text> </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>::takeElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>() &endl;{&endl;</xsl:text> + <xsl:text> </xsl:text> + <xsl:value-of select="$return-cpp-type"/> + <xsl:text> a = m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>;&endl;</xsl:text> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = 0;&endl;</xsl:text> + <xsl:if test="not($isChoice)"> + <xsl:text> m_children ^= </xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>;&endl;</xsl:text> + </xsl:if> + <xsl:text> return a;&endl;</xsl:text> + <xsl:text>}&endl;&endl;</xsl:text> + </xsl:if> + + <xsl:text>void </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>::setElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>(</xsl:text> + <xsl:value-of select="$argument-cpp-type"/> + <xsl:text> a)&endl;</xsl:text> + <xsl:text>{&endl;</xsl:text> + <xsl:choose> + <xsl:when test="$make-kind-enum"> + <xsl:text> clear(false);&endl;</xsl:text> + <xsl:text> m_kind = </xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>;&endl;</xsl:text> + </xsl:when> + <xsl:when test="$xs-type-cat = 'pointer'"> + <xsl:text> delete </xsl:text> + <xsl:text>m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>;&endl;</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:if test="not($isChoice)"> + <xsl:text> m_children |= </xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>;&endl;</xsl:text> + </xsl:if> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = a;&endl;</xsl:text> + <xsl:text>}&endl;&endl;</xsl:text> + </xsl:for-each> + </xsl:template> + + <xsl:template name="child-setter-impl"> + <xsl:param name="node"/> + <xsl:variable name="name" select="concat('Dom', $node/@name)"/> + + <xsl:for-each select="$node/xs:sequence | $node/xs:choice | $node/xs:all"> + <xsl:call-template name="child-setter-impl-helper"> + <xsl:with-param name="node" select="."/> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + + <xsl:template name="child-clear-impl"> + <xsl:param name="node"/> + + <xsl:variable name="name" select="concat('Dom', @name)"/> + <xsl:for-each select="$node/xs:sequence | $node/xs:choice | $node/xs:all"> + <xsl:variable name="isChoice" select="name()='xs:choice'"/> + <xsl:variable name="make-child-enum" select="boolean(xs:sequence) and not(@maxOccurs='unbounded')"/> + + <xsl:for-each select="xs:element"> + <xsl:if test="not($isChoice) and not(@maxOccurs='unbounded')"> + <xsl:variable name="camel-case-name"> + <xsl:call-template name="camel-case"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cap-name"> + <xsl:call-template name="cap-first-char"> + <xsl:with-param name="text" select="$camel-case-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="xs-type-cat"> + <xsl:call-template name="xs-type-category"> + <xsl:with-param name="xs-type" select="@type"/> + <xsl:with-param name="array" select="@maxOccurs='unbounded'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text>void </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>::clearElement</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>()&endl;</xsl:text> + <xsl:text>{&endl;</xsl:text> + <xsl:if test="$xs-type-cat = 'pointer'"> + <xsl:text> delete m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text>;&endl;</xsl:text> + <xsl:text> m_</xsl:text> + <xsl:value-of select="$camel-case-name"/> + <xsl:text> = 0;&endl;</xsl:text> + </xsl:if> + <xsl:text> m_children &= ~</xsl:text> + <xsl:value-of select="$cap-name"/> + <xsl:text>;&endl;</xsl:text> + <xsl:text>}&endl;&endl;</xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:for-each> + </xsl:template> + + +<!-- Implementation --> + + <xsl:template name="class-implementation"> + <xsl:param name="node"/> + + <xsl:call-template name="clear-impl"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:call-template name="ctor-impl"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:call-template name="dtor-impl"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:call-template name="read-impl"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:call-template name="read-impl-qdom"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:call-template name="write-impl"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:call-template name="child-setter-impl"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + <xsl:call-template name="child-clear-impl"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + + </xsl:template> + +<!-- Root --> + + <xsl:template match="xs:schema"> + +<xsl:text>/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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. +** $QT_END_LICENSE$ +** +****************************************************************************/ +</xsl:text> + <xsl:text>#include "ui4_p.h"&endl;</xsl:text> + <xsl:text>&endl;</xsl:text> + <xsl:text>#ifdef QUILOADER_QDOM_READ&endl;</xsl:text> + <xsl:text>#include <QtXml/QDomElement>&endl;</xsl:text> + <xsl:text>#endif&endl;</xsl:text> + <xsl:text>&endl;</xsl:text> + <xsl:text>QT_BEGIN_NAMESPACE&endl;</xsl:text> + + <xsl:text>#ifdef QFORMINTERNAL_NAMESPACE&endl;</xsl:text> + <xsl:text>using namespace QFormInternal;&endl;</xsl:text> + <xsl:text>#endif&endl;</xsl:text> + <xsl:text>&endl;</xsl:text> + + <xsl:text>/*******************************************************************************&endl;</xsl:text> + <xsl:text>** Implementations&endl;</xsl:text> + <xsl:text>*/&endl;&endl;</xsl:text> + + <xsl:for-each select="xs:complexType"> + <xsl:call-template name="class-implementation"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:for-each> + <xsl:text>QT_END_NAMESPACE&endl;</xsl:text> + + <xsl:text>&endl;</xsl:text> + </xsl:template> + +</xsl:stylesheet> diff --git a/tools/designer/data/generate_shared.xsl b/tools/designer/data/generate_shared.xsl new file mode 100644 index 0000000..f7859cd --- /dev/null +++ b/tools/designer/data/generate_shared.xsl @@ -0,0 +1,331 @@ +<!DOCTYPE xsl:stylesheet [ + <!ENTITY endl " "> +]> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema"> + +<!-- Hack to make names camel case + All names in ui files are lowercase, while the element names are + capital case. To make the ui files conforming to the xsd file + keep + the DOM interface we rename them here --> + <xsl:template name="camel-case"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="$text='exportmacro'">exportMacro</xsl:when> + <xsl:when test="$text='layoutdefault'">layoutDefault</xsl:when> + <xsl:when test="$text='layoutfunction'">layoutFunction</xsl:when> + <xsl:when test="$text='pixmapfunction'">pixmapFunction</xsl:when> + <xsl:when test="$text='customwidgets'">customWidgets</xsl:when> + <xsl:when test="$text='tabstops'">tabStops</xsl:when> + <xsl:when test="$text='tabstop'">tabStop</xsl:when> + <xsl:when test="$text='buttongroups'">buttonGroups</xsl:when> + <xsl:when test="$text='exportmacro'">exportMacro</xsl:when> + <xsl:when test="$text='actiongroup'">actionGroup</xsl:when> + <xsl:when test="$text='buttongroup'">buttonGroup</xsl:when> + <xsl:when test="$text='customwidget'">customWidget</xsl:when> + <xsl:when test="$text='sizehint'">sizeHint</xsl:when> + <xsl:when test="$text='addpagemethod'">addPageMethod</xsl:when> + <xsl:when test="$text='sizepolicy'">sizePolicy</xsl:when> + <xsl:when test="$text='hordata'">horData</xsl:when> + <xsl:when test="$text='verdata'">verData</xsl:when> + <xsl:when test="$text='rowspan'">rowSpan</xsl:when> + <xsl:when test="$text='colspan'">colSpan</xsl:when> + <xsl:when test="$text='addaction'">addAction</xsl:when> + <xsl:when test="$text='zorder'">zOrder</xsl:when> + <xsl:when test="$text='startx'">startX</xsl:when> + <xsl:when test="$text='starty'">startY</xsl:when> + <xsl:when test="$text='endx'">endX</xsl:when> + <xsl:when test="$text='endy'">endY</xsl:when> + <xsl:when test="$text='centralx'">centralX</xsl:when> + <xsl:when test="$text='centraly'">centralY</xsl:when> + <xsl:when test="$text='focalx'">focalX</xsl:when> + <xsl:when test="$text='focaly'">focalY</xsl:when> + <xsl:when test="$text='widgetdata'">widgetData</xsl:when> + <xsl:when test="$text='coordinatemode'">coordinateMode</xsl:when> + <xsl:when test="$text='brushstyle'">brushStyle</xsl:when> + <xsl:when test="$text='colorrole'">colorRole</xsl:when> + <xsl:when test="$text='pointsize'">pointSize</xsl:when> + <xsl:when test="$text='strikeout'">strikeOut</xsl:when> + <xsl:when test="$text='stylestrategy'">styleStrategy</xsl:when> + <xsl:when test="$text='hsizetype'">hSizeType</xsl:when> + <xsl:when test="$text='vsizetype'">vSizeType</xsl:when> + <xsl:when test="$text='horstretch'">horStretch</xsl:when> + <xsl:when test="$text='verstretch'">verStretch</xsl:when> + <xsl:when test="$text='normaloff'">normalOff</xsl:when> + <xsl:when test="$text='normalon'">normalOn</xsl:when> + <xsl:when test="$text='disabledoff'">disabledOff</xsl:when> + <xsl:when test="$text='disabledon'">disabledOn</xsl:when> + <xsl:when test="$text='activeoff'">activeOff</xsl:when> + <xsl:when test="$text='activeon'">activeOn</xsl:when> + <xsl:when test="$text='selectedoff'">selectedOff</xsl:when> + <xsl:when test="$text='selectedon'">selectedOn</xsl:when> + <xsl:when test="$text='cursorshape'">cursorShape</xsl:when> + <xsl:when test="$text='iconset'">iconSet</xsl:when> + <xsl:when test="$text='stringlist'">stringList</xsl:when> + <xsl:when test="$text='datetime'">dateTime</xsl:when> + <xsl:when test="$text='pointf'">pointF</xsl:when> + <xsl:when test="$text='rectf'">rectF</xsl:when> + <xsl:when test="$text='sizef'">sizeF</xsl:when> + <xsl:when test="$text='longlong'">longLong</xsl:when> + <xsl:when test="$text='uint'">UInt</xsl:when> + <xsl:when test="$text='ulonglong'">uLongLong</xsl:when> + <xsl:when test="$text='rowstretch'">rowStretch</xsl:when> + <xsl:when test="$text='columnstretch'">columnStretch</xsl:when> + <xsl:when test="$text='rowminimumheight'">rowMinimumHeight</xsl:when> + <xsl:when test="$text='columnminimumwidth'">columnMinimumWidth</xsl:when> + <xsl:when test="$text='extracomment'">extraComment</xsl:when> + <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + +<!-- Convenience templates --> + + <xsl:template name="cap-first-char"> + <xsl:param name="text"/> + <xsl:value-of select="concat(translate(substring($text, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring($text, 2))" /> + </xsl:template> + + <xsl:template name="lower-text"> + <xsl:param name="text"/> + + <xsl:if test="boolean($text)"> + <xsl:variable name="head" select="substring($text, 1, 1)"/> + <xsl:variable name="tail" select="substring($text, 2)"/> + <xsl:variable name="lower-head" select="translate($text, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/> + <xsl:variable name="lower-tail"> + <xsl:call-template name="lower-text"> + <xsl:with-param name="text" select="tail"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select='concat($lower-head, $lower-tail)'/> + </xsl:if> + </xsl:template> + + <xsl:template name="powers-of-two"> + <xsl:param name="num"/> + + <xsl:choose> + <xsl:when test="$num=0">1</xsl:when> + <xsl:otherwise> + <xsl:variable name="x"> + <xsl:call-template name="powers-of-two"> + <xsl:with-param name="num" select="$num - 1"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="2*$x"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +<!-- Convenience templates: xs-types to c++ types conversions --> + + <xsl:template name="xs-type-from-qstring-func"> + <xsl:param name="xs-type"/> + <xsl:param name="val"/> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'"> + <xsl:value-of select="$val"/> + </xsl:when> + <xsl:when test="$xs-type='xs:integer'"> + <xsl:value-of select="$val"/> + <xsl:text>.toInt()</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:float'"> + <xsl:value-of select="$val"/> + <xsl:text>.toFloat()</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:double'"> + <xsl:value-of select="$val"/> + <xsl:text>.toDouble()</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:boolean'"> + <xsl:text>(</xsl:text> + <xsl:value-of select="$val"/> + <xsl:text> == QLatin1String("true") ? true : false)</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:long'"> + <xsl:value-of select="$val"/> + <xsl:text>.toLongLong()</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'"> + <xsl:value-of select="$val"/> + <xsl:text>.toUInt()</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'"> + <xsl:value-of select="$val"/> + <xsl:text>.toULongLong()</xsl:text> + </xsl:when> + <xsl:otherwise>### BZZZZT! ###</xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="xs-type-to-qstring-func"> + <xsl:param name="xs-type"/> + <xsl:param name="val"/> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'"> + <xsl:value-of select="$val"/> + </xsl:when> + <xsl:when test="$xs-type='xs:integer'"> + <xsl:text>QString::number(</xsl:text> + <xsl:value-of select="$val"/> + <xsl:text>)</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:long'"> + <xsl:text>QString::number(</xsl:text> + <xsl:value-of select="$val"/> + <xsl:text>)</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'"> + <xsl:text>QString::number(</xsl:text> + <xsl:value-of select="$val"/> + <xsl:text>)</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'"> + <xsl:text>QString::number(</xsl:text> + <xsl:value-of select="$val"/> + <xsl:text>)</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:float'"> + <xsl:text>QString::number(</xsl:text> + <xsl:value-of select="$val"/> + <xsl:text>, 'f', 8)</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:double'"> + <xsl:text>QString::number(</xsl:text> + <xsl:value-of select="$val"/> + <xsl:text>, 'f', 15)</xsl:text> + </xsl:when> + <xsl:when test="$xs-type='xs:boolean'"> + <xsl:text>(</xsl:text> + <xsl:value-of select="$val"/> + <xsl:text> ? QLatin1String("true") : QLatin1String("false"))</xsl:text> + </xsl:when> + <xsl:otherwise>### BZZZZT! ###</xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="xs-type-category"> + <xsl:param name="xs-type"/> + <xsl:param name="array" select="false"/> + <xsl:choose> + <xsl:when test="$array">value</xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'">value</xsl:when> + <xsl:when test="$xs-type='xs:integer'">value</xsl:when> + <xsl:when test="$xs-type='xs:float'">value</xsl:when> + <xsl:when test="$xs-type='xs:double'">value</xsl:when> + <xsl:when test="$xs-type='xs:boolean'">value</xsl:when> + <xsl:when test="$xs-type='xs:long'">value</xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'">value</xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'">value</xsl:when> + <xsl:otherwise>pointer</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="xs-type-to-cpp-type"> + <xsl:param name="xs-type"/> + <xsl:param name="array" select="false"/> + <xsl:choose> + <xsl:when test="$array"> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'">QStringList</xsl:when> + <xsl:when test="$xs-type='xs:integer'">QList<int></xsl:when> + <xsl:when test="$xs-type='xs:float'">QList<float></xsl:when> + <xsl:when test="$xs-type='xs:double'">QList<double></xsl:when> + <xsl:when test="$xs-type='xs:boolean'">QList<bool></xsl:when> + <xsl:when test="$xs-type='xs:long'">QList<qlonglong></xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'">QList<uint></xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'">QList<qulonglong></xsl:when> + <xsl:otherwise>QList<Dom<xsl:value-of select="$xs-type"/>*></xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'">QString</xsl:when> + <xsl:when test="$xs-type='xs:integer'">int</xsl:when> + <xsl:when test="$xs-type='xs:float'">float</xsl:when> + <xsl:when test="$xs-type='xs:double'">double</xsl:when> + <xsl:when test="$xs-type='xs:boolean'">bool</xsl:when> + <xsl:when test="$xs-type='xs:long'">qlonglong</xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'">uint</xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'">qulonglong</xsl:when> + <xsl:otherwise>Dom<xsl:value-of select="$xs-type"/></xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="xs-type-to-cpp-return-type"> + <xsl:param name="xs-type"/> + <xsl:param name="array" select="false"/> + <xsl:choose> + <xsl:when test="$array"> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'">QStringList</xsl:when> + <xsl:when test="$xs-type='xs:integer'">QList<int></xsl:when> + <xsl:when test="$xs-type='xs:float'">QList<float></xsl:when> + <xsl:when test="$xs-type='xs:double'">QList<double></xsl:when> + <xsl:when test="$xs-type='xs:boolean'">QList<bool></xsl:when> + <xsl:when test="$xs-type='xs:long'">QList<qlonglong></xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'">QList<uint></xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'">QList<qulonglong></xsl:when> + <xsl:otherwise>QList<Dom<xsl:value-of select="$xs-type"/>*></xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'">QString</xsl:when> + <xsl:when test="$xs-type='xs:integer'">int</xsl:when> + <xsl:when test="$xs-type='xs:float'">float</xsl:when> + <xsl:when test="$xs-type='xs:double'">double</xsl:when> + <xsl:when test="$xs-type='xs:boolean'">bool</xsl:when> + <xsl:when test="$xs-type='xs:long'">qlonglong</xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'">uint</xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'">qulonglong</xsl:when> + <xsl:otherwise>Dom<xsl:value-of select="$xs-type"/>*</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="xs-type-to-cpp-argument-type"> + <xsl:param name="xs-type"/> + <xsl:param name="array" select="false"/> + <xsl:choose> + <xsl:when test="$array"> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'">const QStringList&</xsl:when> + <xsl:when test="$xs-type='xs:integer'">const QList<int>&</xsl:when> + <xsl:when test="$xs-type='xs:float'">const QList<float>&</xsl:when> + <xsl:when test="$xs-type='xs:double'">const QList<double>&</xsl:when> + <xsl:when test="$xs-type='xs:boolean'">const QList<bool>&</xsl:when> + <xsl:when test="$xs-type='xs:long'">const QList<qlonglong>&</xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'">const QList<uint>&</xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'">const QList<qulonglong>&</xsl:when> + <xsl:otherwise>const QList<Dom<xsl:value-of select="$xs-type"/>*>&</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$xs-type='xs:string'">const QString&</xsl:when> + <xsl:when test="$xs-type='xs:integer'">int</xsl:when> + <xsl:when test="$xs-type='xs:float'">float</xsl:when> + <xsl:when test="$xs-type='xs:double'">double</xsl:when> + <xsl:when test="$xs-type='xs:boolean'">bool</xsl:when> + <xsl:when test="$xs-type='xs:long'">qlonglong</xsl:when> + <xsl:when test="$xs-type='xs:unsignedInt'">uint</xsl:when> + <xsl:when test="$xs-type='xs:unsignedLong'">qulonglong</xsl:when> + <xsl:otherwise>Dom<xsl:value-of select="$xs-type"/>*</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + +</xsl:stylesheet> diff --git a/tools/designer/data/ui3.xsd b/tools/designer/data/ui3.xsd new file mode 100644 index 0000000..06f325e --- /dev/null +++ b/tools/designer/data/ui3.xsd @@ -0,0 +1,353 @@ +<?xml version="1.0" encoding="utf-8" ?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="UI"> + <xs:complexType> + <xs:choice maxOccurs="unbounded"> + <xs:element name="actions"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="action"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="property" type="property" /> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="author" type="xs:string" /> + <xs:element name="class" type="xs:string" /> + <xs:element name="comment" type="xs:string" /> + <xs:element name="connections"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="connection"> + <xs:complexType> + <xs:sequence> + <xs:element name="sender" type="xs:string" /> + <xs:element name="signal" type="xs:string" /> + <xs:element name="receiver" type="xs:string" /> + <xs:element name="slot" type="xs:string" /> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="customWidgets" type="xs:string" /> + <xs:element name="exportmacro" type="xs:string" /> + <xs:element name="forwards"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="forward" type="xs:string" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="images"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="image"> + <xs:complexType> + <xs:sequence> + <xs:element name="data"> + <xs:complexType> + <xs:sequence /> + <xs:attribute name="format" type="xs:string" /> + <xs:attribute name="length" type="xs:integer" /> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="xs:string" /> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="includes"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="include"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="location" type="xs:string" /> + <xs:attribute name="impldecl" type="xs:string" /> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="layoutDefaults"> + <xs:complexType> + <xs:sequence /> + <xs:attribute name="spacing" type="xs:integer" /> + <xs:attribute name="margin" type="xs:integer" /> + </xs:complexType> + </xs:element> + <xs:element name="layoutFunctions"> + <xs:complexType> + <xs:sequence /> + <xs:attribute name="spacing" type="xs:string" /> + <xs:attribute name="margin" type="xs:string" /> + </xs:complexType> + </xs:element> + <xs:element name="menubar"> + <xs:complexType> + <xs:sequence> + <xs:choice maxOccurs="unbounded"> + <xs:element name="property" type="property" /> + <xs:element name="item"> + <xs:complexType> + <xs:sequence> + <xs:choice maxOccurs="unbounded"> + <xs:element name="action"> + <xs:complexType> + <xs:sequence /> + <xs:attribute name="name" type="xs:string" /> + </xs:complexType> + </xs:element> + <xs:element name="item"> + </xs:element> + <xs:element name="separator" type="xs:string" /> + </xs:choice> + </xs:sequence> + <xs:attribute name="name" type="xs:string" /> + <xs:attribute name="text" type="xs:string" /> + </xs:complexType> + </xs:element> + </xs:choice> + <xs:element name="class" type="xs:string" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="pixmapfunction" type="xs:string" /> + <xs:element name="signals"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="signal" type="xs:string" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="slots"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="slot"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="access" type="xs:string" /> + <xs:attribute name="specifier" type="xs:string" /> + <xs:attribute name="language" type="xs:string" /> + <xs:attribute name="returnType" type="xs:string" /> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="tabstops"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="tabstop" type="xs:string" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="toolbars"> + <xs:complexType> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="toolbar"> + <xs:complexType> + <xs:choice maxOccurs="unbounded"> + <xs:element name="property" type="property" /> + <xs:element name="action"> + <xs:complexType> + <xs:sequence /> + <xs:attribute name="name" type="xs:string" /> + </xs:complexType> + </xs:element> + <xs:element name="separator" type="xs:string" /> + </xs:choice> + <xs:attribute name="dock" type="xs:integer" /> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="variables"> + <xs:complexType> + <xs:sequence> + <xs:element name="variable"> + <xs:complexType> + <xs:sequence /> + <xs:attribute name="access" type="xs:string" /> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="widget" type="widget" /> + <xs:element name="include" type="xs:string" /> + <xs:element name="variable" type="xs:string" /> + </xs:choice> + <xs:attribute name="version" type="xs:string" /> + <xs:attribute name="stdsetdef" type="xs:integer" /> + </xs:complexType> + </xs:element> + + <xs:complexType name="layout"> + <xs:choice maxOccurs="unbounded"> + <xs:element name="property" type="property" /> + <xs:element name="widget" type="widget" /> + <xs:element name="spacer" type="spacer" /> + </xs:choice> + </xs:complexType> + + <xs:complexType name="widget"> + <xs:choice maxOccurs="unbounded"> + <xs:element name="class" type="xs:string" /> + <xs:element name="property" type="property" /> + <xs:element name="hbox" type="layout" /> + <xs:element name="vbox" type="layout" /> + <xs:element name="grid" type="layout" /> + <xs:element name="widget" type="widget" /> + </xs:choice> + <xs:attribute name="class" type="xs:string" /> + <xs:attribute name="row" type="xs:integer" /> <!-- ### remove me --> + <xs:attribute name="column" type="xs:integer" /> <!-- ### remove me --> + </xs:complexType> + + <xs:complexType name="spacer"> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="property" type="property" /> + </xs:sequence> + <xs:attribute name="row" type="xs:integer" /> <!-- ### remove me --> + <xs:attribute name="column" type="xs:integer" /> <!-- ### remove me --> + <xs:attribute name="rowspan" type="xs:integer" /> <!-- ### remove me --> + <xs:attribute name="colspan" type="xs:integer" /> <!-- ### remove me --> + </xs:complexType> + + <xs:complexType name="color"> + <xs:sequence> + <xs:element name="red" type="xs:integer" /> + <xs:element name="green" type="xs:integer" /> + <xs:element name="blue" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="colorGroup"> + <xs:choice maxOccurs="unbounded"> + <xs:element name="color" type="color" /> + <xs:element name="pixmap" type="xs:string" /> + </xs:choice> + </xs:complexType> + + <xs:complexType name="palette"> + <xs:sequence> + <xs:element name="active" type="colorGroup" /> + <xs:element name="inactive" type="colorGroup" /> + <xs:element name="disabled" type="colorGroup" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="font"> + <xs:sequence> + <xs:element name="family" type="xs:string" /> + <xs:element name="pointSize" type="xs:integer" /> + <xs:element name="weight" type="xs:integer" /> + <xs:element name="italic" type="xs:boolean" /> + <xs:element name="bold" type="xs:boolean" /> + <xs:element name="underline" type="xs:boolean" /> + <xs:element name="strikeout" type="xs:boolean" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="point"> + <xs:sequence> + <xs:element name="x" type="xs:integer" /> + <xs:element name="y" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="rect"> + <xs:sequence> + <xs:element name="x" type="xs:integer" /> + <xs:element name="y" type="xs:integer" /> + <xs:element name="width" type="xs:integer" /> + <xs:element name="height" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="sizePolicy"> + <xs:sequence> + <xs:element name="hsizetype" type="xs:integer" /> + <xs:element name="vsizetype" type="xs:integer" /> + <xs:element name="horstretch" type="xs:integer" /> + <xs:element name="verstretch" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="size"> + <xs:sequence> + <xs:element name="width" type="xs:integer" /> + <xs:element name="height" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="date"> + <xs:sequence> + <xs:element name="year" type="xs:integer" /> + <xs:element name="month" type="xs:integer" /> + <xs:element name="day" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="time"> + <xs:sequence> + <xs:element name="hour" type="xs:integer" /> + <xs:element name="minute" type="xs:integer" /> + <xs:element name="second" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="dateTime"> + <xs:sequence> + <xs:element name="hour" type="xs:integer" /> + <xs:element name="minute" type="xs:integer" /> + <xs:element name="second" type="xs:integer" /> + <xs:element name="year" type="xs:integer" /> + <xs:element name="month" type="xs:integer" /> + <xs:element name="day" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="property"> + <xs:choice> + <xs:element name="bool" type="xs:boolean" /> + <xs:element name="color" type="color" /> + <xs:element name="cstring" type="xs:string" /> + <xs:element name="cursor" type="xs:integer" /> + <xs:element name="enum" type="xs:string" /> + <xs:element name="font" type ="font" /> + <xs:element name="iconset" type="xs:string" /> + <xs:element name="palette" type="palette" /> + <xs:element name="point" type="point" /> + <xs:element name="rect" type="rect" /> + <xs:element name="set" type="xs:string" /> + <xs:element name="sizePolicy" type="sizePolicy" /> + <xs:element name="size" type="size" /> + <xs:element name="string" type="xs:string" /> + <xs:element name="number" type="xs:integer" /> + <xs:element name="date" type="date" /> + <xs:element name="time" type="time" /> + <xs:element name="dateTime" type="dateTime" /> + </xs:choice> + <xs:attribute name="name" type="xs:string" /> + <xs:attribute name="stdset" type="xs:integer" /> + </xs:complexType> + +</xs:schema>
\ No newline at end of file diff --git a/tools/designer/data/ui4.xsd b/tools/designer/data/ui4.xsd new file mode 100644 index 0000000..703e497 --- /dev/null +++ b/tools/designer/data/ui4.xsd @@ -0,0 +1,574 @@ +<?xml version="1.0" encoding="utf-8" ?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="ui" type="UI"/> + + <xs:complexType name="UI"> + <xs:all> + <xs:element name="author" type="xs:string" minOccurs="0" /> + <xs:element name="comment" type="xs:string" minOccurs="0" /> + <xs:element name="exportmacro" type="xs:string" minOccurs="0" /> + <xs:element name="class" type="xs:string" /> + <xs:element name="widget" type="Widget" /> + <xs:element name="layoutdefault" type="LayoutDefault" minOccurs="0" /> + <xs:element name="layoutfunction" type="LayoutFunction" minOccurs="0" /> + <xs:element name="pixmapfunction" type="xs:string" minOccurs="0" /> + <xs:element name="customwidgets" type="CustomWidgets" minOccurs="0" /> + <xs:element name="tabstops" type="TabStops" minOccurs="0" /> + <xs:element name="images" type="Images" minOccurs="0" /> + <xs:element name="includes" type="Includes" minOccurs="0" /> + <xs:element name="resources" type="Resources" minOccurs="0" /> + <xs:element name="connections" type="Connections" minOccurs="0" /> + <xs:element name="designerdata" type="DesignerData" minOccurs="0" /> + <xs:element name="slots" type="Slots" minOccurs="0" /> + <xs:element name="buttongroups" type="ButtonGroups" minOccurs="0" /> + </xs:all> + <xs:attribute name="version" type="xs:string" use="required" /> + <xs:attribute name="language" type="xs:string" /> + <xs:attribute name="displayname" type="xs:string" /> +<!-- Legacy attribute generated by uic3 --> + <xs:attribute name="stdsetdef" type="xs:integer" /> +<!-- Legacy attribute generated by the VS integration --> + <xs:attribute name="stdSetDef" type="xs:integer" /> + </xs:complexType> + +<!-- include begin --> + <xs:complexType name="Includes"> + <xs:sequence> + <xs:element name="include" type="Include" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Include" mixed="true" > + <xs:attribute name="location" type="xs:string" use="required" /> + <xs:attribute name="impldecl" type="xs:string" /> + </xs:complexType> +<!-- include end --> + +<!-- resource begin --> + <xs:complexType name="Resources"> + <xs:sequence> + <xs:element name="include" type="Resource" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="name" type="xs:string" /> + </xs:complexType> + + <xs:complexType name="Resource"> + <xs:attribute name="location" type="xs:string" use="required" /> + </xs:complexType> +<!-- resource end --> + +<!-- actions begin --> + <xs:complexType name="ActionGroup"> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="action" type="Action" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="actiongroup" type="ActionGroup" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="attribute" type="Property" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="Action"> + <xs:sequence maxOccurs="unbounded" > + <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="attribute" type="Property" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required" /> + <xs:attribute name="menu" type="xs:string" /> + </xs:complexType> + + <xs:complexType name="ActionRef"> + <xs:attribute name="name" type="xs:string" use="required" /> + </xs:complexType> +<!-- actions end --> + +<!-- button groups begin --> + <xs:complexType name="ButtonGroup"> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="attribute" type="Property" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="ButtonGroups"> + <xs:sequence> + <xs:element name="buttongroup" type="ButtonGroup" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> +<!-- button groups end --> + +<!-- images begin --> + <xs:complexType name="Images"> + <xs:sequence> + <xs:element name="image" type="Image" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Image"> + <xs:sequence> + <xs:element name="data" type="ImageData" /> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="ImageData" mixed="true" > + <xs:attribute name="format" type="xs:string" use="required" /> + <xs:attribute name="length" type="xs:integer" use="required" /> + </xs:complexType> +<!-- images end --> + +<!-- custom widget support begin --> + <xs:complexType name="CustomWidgets"> + <xs:sequence> + <xs:element name="customwidget" type="CustomWidget" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Header" mixed="true" > + <xs:attribute name="location" type="xs:string" /> <!-- local or global --> + </xs:complexType> + + <xs:complexType name="CustomWidget"> + <xs:all> + <xs:element name="class" type="xs:string" /> + <xs:element name="extends" type="xs:string" /> + <xs:element name="header" type="Header" /> + <xs:element name="sizehint" type="Size" minOccurs="0" /> + <xs:element name="addpagemethod" type="xs:string" minOccurs="0" /> + <xs:element name="container" type="xs:integer" minOccurs="0" /> + <xs:element name="sizepolicy" type="SizePolicyData" minOccurs="0" /> + <xs:element name="pixmap" type="xs:string" minOccurs="0" /> + <xs:element name="script" type="Script" minOccurs="0" /> + <xs:element name="properties" type="Properties" minOccurs="0" /> + <xs:element name="slots" type="Slots" minOccurs="0" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="Properties"> + <xs:sequence> + <xs:element name="property" type="PropertyData" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="PropertyData"> + <xs:attribute name="type" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="SizePolicyData"> + <xs:all> + <xs:element name="hordata" type="xs:integer" /> + <xs:element name="verdata" type="xs:integer" /> + </xs:all> + </xs:complexType> + +<!-- custom widget support end --> + + <xs:complexType name="LayoutDefault"> + <xs:attribute name="spacing" type="xs:integer" use="required" /> + <xs:attribute name="margin" type="xs:integer" use="required" /> + </xs:complexType> + + <xs:complexType name="LayoutFunction"> + <xs:attribute name="spacing" type="xs:string" use="required" /> + <xs:attribute name="margin" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="TabStops"> + <xs:sequence> + <xs:element name="tabstop" type="xs:string" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Layout"> + <xs:sequence maxOccurs="unbounded" > + <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="attribute" type="Property" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="item" type="LayoutItem" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="class" type="xs:string" use="required" /> + <xs:attribute name="name" type="xs:string" /> + <xs:attribute name="stretch" type="xs:string" /> + <xs:attribute name="rowstretch" type="xs:string" /> + <xs:attribute name="columnstretch" type="xs:string" /> + <xs:attribute name="rowminimumheight" type="xs:string" /> + <xs:attribute name="columnminimumwidth" type="xs:string" /> + </xs:complexType> + + <xs:complexType name="LayoutItem"> + <xs:choice> + <xs:element name="widget" type="Widget" /> + <xs:element name="layout" type="Layout" /> + <xs:element name="spacer" type="Spacer" /> + </xs:choice> + <xs:attribute name="row" type="xs:integer" /> + <xs:attribute name="column" type="xs:integer" /> + <xs:attribute name="rowspan" type="xs:integer" /> + <xs:attribute name="colspan" type="xs:integer" /> + </xs:complexType> + +<!-- item view begin --> + <xs:complexType name="Row"> + <xs:sequence> + <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Column"> + <xs:sequence> + <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Item"> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="item" type="Item" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="row" type="xs:integer" /> + <xs:attribute name="column" type="xs:integer" /> + </xs:complexType> +<!-- item view end --> + + <xs:complexType name="Widget"> + <!-- Order does not matter (cannot use xs:all here + because of unbounded row, column, item --> + <xs:sequence> + <xs:element name="class" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> <!-- unbounded kept for compatibility reasons --> + <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="script" type="Script" minOccurs="0" maxOccurs="unbounded" /> <!-- unbounded kept for compatibility reasons --> + <xs:element name="widgetdata" type="WidgetData" minOccurs="0" maxOccurs="unbounded" /> <!-- unbounded kept for compatibility reasons --> + <xs:element name="attribute" type="Property" minOccurs="0" maxOccurs="unbounded" /> +<!-- item view begin --> + <xs:element name="row" type="Row" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="column" type="Column" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="item" type="Item" minOccurs="0" maxOccurs="unbounded" /> +<!-- item view end --> + <xs:element name="layout" type="Layout" minOccurs="0" maxOccurs="unbounded" /> <!-- unbounded kept for compatibility reasons --> + <xs:element name="widget" type="Widget" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="action" type="Action" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="actiongroup" type="ActionGroup" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="addaction" type="ActionRef" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="zorder" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="class" type="xs:string" use="required" /> + <xs:attribute name="name" type="xs:string" /> + <xs:attribute name="native" type="xs:boolean" /> + </xs:complexType> + + <xs:complexType name="Spacer"> + <xs:sequence> + <xs:element name="property" type="Property" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="name" type="xs:string" /> + </xs:complexType> + + <xs:complexType name="Color"> + <xs:all> + <xs:element name="red" type="xs:integer" /> + <xs:element name="green" type="xs:integer" /> + <xs:element name="blue" type="xs:integer" /> + </xs:all> + <xs:attribute name="alpha" type="xs:integer" /> + </xs:complexType> + + <xs:complexType name="GradientStop"> + <xs:sequence> + <xs:element name="color" type="Color" /> + </xs:sequence> + <xs:attribute name="position" type="xs:double" use="required" /> + </xs:complexType> + + <xs:complexType name="Gradient"> + <xs:sequence> + <xs:element name="gradientStop" type="GradientStop" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="startx" type="xs:double" use="required" /> + <xs:attribute name="starty" type="xs:double" use="required" /> + <xs:attribute name="endx" type="xs:double" use="required" /> + <xs:attribute name="endy" type="xs:double" use="required" /> + <xs:attribute name="centralx" type="xs:double" use="required" /> + <xs:attribute name="centraly" type="xs:double" use="required" /> + <xs:attribute name="focalx" type="xs:double" use="required" /> + <xs:attribute name="focaly" type="xs:double" use="required" /> + <xs:attribute name="radius" type="xs:double" use="required" /> + <xs:attribute name="angle" type="xs:double" use="required" /> + <xs:attribute name="type" type="xs:string" use="required" /> + <xs:attribute name="spread" type="xs:string" use="required" /> + <xs:attribute name="coordinatemode" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="Brush"> + <xs:choice> + <xs:element name="color" type="Color" /> + <xs:element name="texture" type="Property" /> + <xs:element name="gradient" type="Gradient" /> + </xs:choice> + <xs:attribute name="brushstyle" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="ColorRole"> + <xs:sequence> + <xs:element name="brush" type="Brush" /> + </xs:sequence> + <xs:attribute name="role" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="ColorGroup"> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="colorrole" type="ColorRole" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="color" type="Color" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Palette"> + <xs:all> + <xs:element name="active" type="ColorGroup" /> + <xs:element name="inactive" type="ColorGroup" /> + <xs:element name="disabled" type="ColorGroup" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="Font"> + <xs:all> + <xs:element name="family" type="xs:string" minOccurs="0" /> + <xs:element name="pointsize" type="xs:integer" minOccurs="0" /> + <xs:element name="weight" type="xs:integer" minOccurs="0" /> + <xs:element name="italic" type="xs:boolean" minOccurs="0" /> + <xs:element name="bold" type="xs:boolean" minOccurs="0" /> + <xs:element name="underline" type="xs:boolean" minOccurs="0" /> + <xs:element name="strikeout" type="xs:boolean" minOccurs="0" /> + <xs:element name="antialiasing" type="xs:boolean" minOccurs="0" /> + <xs:element name="stylestrategy" type="xs:string" minOccurs="0" /> + <xs:element name="kerning" type="xs:boolean" minOccurs="0" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="Point"> + <xs:all> + <xs:element name="x" type="xs:integer" /> + <xs:element name="y" type="xs:integer" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="Rect"> + <xs:all> + <xs:element name="x" type="xs:integer" /> + <xs:element name="y" type="xs:integer" /> + <xs:element name="width" type="xs:integer" /> + <xs:element name="height" type="xs:integer" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="Locale"> + <xs:attribute name="language" type="xs:string" use="required" /> + <xs:attribute name="country" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="SizePolicy"> + <xs:all> + <xs:element name="hsizetype" type="xs:integer" minOccurs="0" /> + <xs:element name="vsizetype" type="xs:integer" minOccurs="0" /> + <xs:element name="horstretch" type="xs:integer" /> + <xs:element name="verstretch" type="xs:integer" /> + </xs:all> + <xs:attribute name="hsizetype" type="xs:string" /> + <xs:attribute name="vsizetype" type="xs:string" /> + </xs:complexType> + + <xs:complexType name="Size"> + <xs:all> + <xs:element name="width" type="xs:integer" /> + <xs:element name="height" type="xs:integer" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="Date"> + <xs:all> + <xs:element name="year" type="xs:integer" /> + <xs:element name="month" type="xs:integer" /> + <xs:element name="day" type="xs:integer" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="Time"> + <xs:all> + <xs:element name="hour" type="xs:integer" /> + <xs:element name="minute" type="xs:integer" /> + <xs:element name="second" type="xs:integer" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="DateTime"> + <xs:all> + <xs:element name="hour" type="xs:integer" /> + <xs:element name="minute" type="xs:integer" /> + <xs:element name="second" type="xs:integer" /> + <xs:element name="year" type="xs:integer" /> + <xs:element name="month" type="xs:integer" /> + <xs:element name="day" type="xs:integer" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="StringList"> + <xs:sequence> + <xs:element name="string" type="xs:string" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ResourcePixmap" mixed="true"> + <xs:attribute name="resource" type="xs:string" /> + <xs:attribute name="alias" type="xs:string" /> + </xs:complexType> + + <xs:complexType name="ResourceIcon" mixed="true"> + <xs:all> + <xs:element name="normaloff" type="ResourcePixmap" minOccurs="0" /> + <xs:element name="normalon" type="ResourcePixmap" minOccurs="0" /> + <xs:element name="disabledoff" type="ResourcePixmap" minOccurs="0" /> + <xs:element name="disabledon" type="ResourcePixmap" minOccurs="0" /> + <xs:element name="activeoff" type="ResourcePixmap" minOccurs="0" /> + <xs:element name="activeon" type="ResourcePixmap" minOccurs="0" /> + <xs:element name="selectedoff" type="ResourcePixmap" minOccurs="0" /> + <xs:element name="selectedon" type="ResourcePixmap" minOccurs="0" /> + </xs:all> + <xs:attribute name="resource" type="xs:string" /> <!-- pre 4.4 legacy support --> + </xs:complexType> + + <xs:complexType name="String" mixed="true"> + <xs:attribute name="notr" type="xs:string" /> + <xs:attribute name="comment" type="xs:string" /> + <xs:attribute name="extracomment" type="xs:string" /> + </xs:complexType> + + <xs:complexType name="PointF"> + <xs:all> + <xs:element name="x" type="xs:double" /> + <xs:element name="y" type="xs:double" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="RectF"> + <xs:all> + <xs:element name="x" type="xs:double" /> + <xs:element name="y" type="xs:double" /> + <xs:element name="width" type="xs:double" /> + <xs:element name="height" type="xs:double" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="SizeF"> + <xs:all> + <xs:element name="width" type="xs:double" /> + <xs:element name="height" type="xs:double" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="Char"> + <xs:sequence> + <xs:element name="unicode" type="xs:integer" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Url"> + <xs:sequence> + <xs:element name="string" type="String" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Property"> + <xs:choice> + <xs:element name="bool" type="xs:string" /> + <xs:element name="color" type="Color" /> + <xs:element name="cstring" type="xs:string" /> + <xs:element name="cursor" type="xs:integer" /> + <xs:element name="cursorshape" type="xs:string" /> + <xs:element name="enum" type="xs:string" /> + <xs:element name="font" type ="Font" /> + <xs:element name="iconset" type="ResourceIcon"/> + <xs:element name="pixmap" type="ResourcePixmap" /> + <xs:element name="palette" type="Palette" /> + <xs:element name="point" type="Point" /> + <xs:element name="rect" type="Rect" /> + <xs:element name="set" type="xs:string" /> + <xs:element name="locale" type="Locale" /> + <xs:element name="sizepolicy" type="SizePolicy" /> + <xs:element name="size" type="Size" /> + <xs:element name="string" type="String" /> + <xs:element name="stringlist" type="StringList" /> + <xs:element name="number" type="xs:integer" /> + <xs:element name="float" type="xs:float" /> + <xs:element name="double" type="xs:double" /> + <xs:element name="date" type="Date" /> + <xs:element name="time" type="Time" /> + <xs:element name="datetime" type="DateTime" /> + <xs:element name="pointf" type="PointF" /> + <xs:element name="rectf" type="RectF" /> + <xs:element name="sizef" type="SizeF" /> + <xs:element name="longlong" type="xs:long" /> + <xs:element name="char" type="Char" /> + <xs:element name="url" type="Url" /> + <xs:element name="uint" type="xs:unsignedInt" /> + <xs:element name="ulonglong" type="xs:unsignedLong" /> + <xs:element name="brush" type="Brush" /> + </xs:choice> + <xs:attribute name="name" type="xs:string" use="required" /> + <xs:attribute name="stdset" type="xs:integer" /> + </xs:complexType> + + <xs:complexType name="Connections"> + <xs:sequence> + <xs:element name="connection" type="Connection" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Connection"> + <xs:all> + <xs:element name="sender" type="xs:string" /> + <xs:element name="signal" type="xs:string" /> + <xs:element name="receiver" type="xs:string" /> + <xs:element name="slot" type="xs:string" /> + <xs:element name="hints" type="ConnectionHints" minOccurs="0" /> + </xs:all> + </xs:complexType> + + <xs:complexType name="ConnectionHints"> + <xs:sequence> + <xs:element name="hint" type="ConnectionHint" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ConnectionHint"> + <xs:all> + <xs:element name="x" type="xs:integer"/> + <xs:element name="y" type="xs:integer"/> + </xs:all> + <xs:attribute name="type" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="Script"> + <xs:attribute name="source" type="xs:string" use="required" /> + <xs:attribute name="language" type="xs:string" use="required" /> + </xs:complexType> + + <xs:complexType name="WidgetData"> + <xs:sequence> + <xs:element name="property" type="Property" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="DesignerData"> + <xs:sequence> + <xs:element name="property" type="Property" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Slots"> + <xs:sequence maxOccurs="unbounded"> + <xs:element name="signal" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> + <xs:element name="slot" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + +</xs:schema> |