1
1
/****************************************************************************
3
3
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
** All rights reserved.
4
5
** Contact: Nokia Corporation (qt-info@nokia.com)
6
7
** This file is part of the tools applications of the Qt Toolkit.
8
9
** $QT_BEGIN_LICENSE:LGPL$
10
** Licensees holding valid Qt Commercial licenses may use this file in
11
** accordance with the Qt Commercial License Agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and Nokia.
10
** No Commercial Usage
11
** This file contains pre-release code and may not be distributed.
12
** You may use this file in accordance with the terms and conditions
13
** contained in the Technology Preview License Agreement accompanying
15
16
** GNU Lesser General Public License Usage
16
17
** Alternatively, this file may be used under the terms of the GNU Lesser
20
21
** ensure the GNU Lesser General Public License version 2.1 requirements
21
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
** In addition, as a special exception, Nokia gives you certain
24
** additional rights. These rights are described in the Nokia Qt LGPL
25
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
28
** GNU General Public License Usage
29
** Alternatively, this file may be used under the terms of the GNU
30
** General Public License version 3.0 as published by the Free Software
31
** Foundation and appearing in the file LICENSE.GPL included in the
32
** packaging of this file. Please review the following information to
33
** ensure the GNU General Public License version 3.0 requirements will be
34
** met: http://www.gnu.org/copyleft/gpl.html.
36
** If you are unsure which license is appropriate for your use, please
37
** contact the sales department at http://www.qtsoftware.com/contact.
24
** In addition, as a special exception, Nokia gives you certain additional
25
** rights. These rights are described in the Nokia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at qt-info@nokia.com.
38
38
** $QT_END_LICENSE$
40
40
****************************************************************************/
10928
void DomPropertySpecifications::clear(bool clear_all)
10930
qDeleteAll(m_stringpropertyspecification);
10931
m_stringpropertyspecification.clear();
10940
DomPropertySpecifications::DomPropertySpecifications()
10945
DomPropertySpecifications::~DomPropertySpecifications()
10947
qDeleteAll(m_stringpropertyspecification);
10948
m_stringpropertyspecification.clear();
10951
void DomPropertySpecifications::read(QXmlStreamReader &reader)
10954
for (bool finished = false; !finished && !reader.hasError();) {
10955
switch (reader.readNext()) {
10956
case QXmlStreamReader::StartElement : {
10957
const QString tag = reader.name().toString().toLower();
10958
if (tag == QLatin1String("stringpropertyspecification")) {
10959
DomStringPropertySpecification *v = new DomStringPropertySpecification();
10961
m_stringpropertyspecification.append(v);
10964
reader.raiseError(QLatin1String("Unexpected element ") + tag);
10967
case QXmlStreamReader::EndElement :
10970
case QXmlStreamReader::Characters :
10971
if (!reader.isWhitespace())
10972
m_text.append(reader.text().toString());
10980
#ifdef QUILOADER_QDOM_READ
10981
void DomPropertySpecifications::read(const QDomElement &node)
10983
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
10984
if (!n.isElement())
10986
QDomElement e = n.toElement();
10987
QString tag = e.tagName().toLower();
10988
if (tag == QLatin1String("stringpropertyspecification")) {
10989
DomStringPropertySpecification *v = new DomStringPropertySpecification();
10991
m_stringpropertyspecification.append(v);
10996
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
10997
if (child.isText())
10998
m_text.append(child.nodeValue());
11003
void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const
11005
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower());
11007
for (int i = 0; i < m_stringpropertyspecification.size(); ++i) {
11008
DomStringPropertySpecification* v = m_stringpropertyspecification[i];
11009
v->write(writer, QLatin1String("stringpropertyspecification"));
11011
if (!m_text.isEmpty())
11012
writer.writeCharacters(m_text);
11014
writer.writeEndElement();
11017
void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a)
11019
m_children |= Stringpropertyspecification;
11020
m_stringpropertyspecification = a;
11023
void DomStringPropertySpecification::clear(bool clear_all)
11028
m_has_attr_name = false;
11029
m_has_attr_type = false;
11030
m_has_attr_notr = false;
11036
DomStringPropertySpecification::DomStringPropertySpecification()
11039
m_has_attr_name = false;
11040
m_has_attr_type = false;
11041
m_has_attr_notr = false;
11044
DomStringPropertySpecification::~DomStringPropertySpecification()
11048
void DomStringPropertySpecification::read(QXmlStreamReader &reader)
11051
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
11052
QStringRef name = attribute.name();
11053
if (name == QLatin1String("name")) {
11054
setAttributeName(attribute.value().toString());
11057
if (name == QLatin1String("type")) {
11058
setAttributeType(attribute.value().toString());
11061
if (name == QLatin1String("notr")) {
11062
setAttributeNotr(attribute.value().toString());
11065
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
11068
for (bool finished = false; !finished && !reader.hasError();) {
11069
switch (reader.readNext()) {
11070
case QXmlStreamReader::StartElement : {
11071
const QString tag = reader.name().toString().toLower();
11072
reader.raiseError(QLatin1String("Unexpected element ") + tag);
11075
case QXmlStreamReader::EndElement :
11078
case QXmlStreamReader::Characters :
11079
if (!reader.isWhitespace())
11080
m_text.append(reader.text().toString());
11088
#ifdef QUILOADER_QDOM_READ
11089
void DomStringPropertySpecification::read(const QDomElement &node)
11091
if (node.hasAttribute(QLatin1String("name")))
11092
setAttributeName(node.attribute(QLatin1String("name")));
11093
if (node.hasAttribute(QLatin1String("type")))
11094
setAttributeType(node.attribute(QLatin1String("type")));
11095
if (node.hasAttribute(QLatin1String("notr")))
11096
setAttributeNotr(node.attribute(QLatin1String("notr")));
11098
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
11099
if (!n.isElement())
11101
QDomElement e = n.toElement();
11102
QString tag = e.tagName().toLower();
11105
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
11106
if (child.isText())
11107
m_text.append(child.nodeValue());
11112
void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const
11114
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower());
11116
if (hasAttributeName())
11117
writer.writeAttribute(QLatin1String("name"), attributeName());
11119
if (hasAttributeType())
11120
writer.writeAttribute(QLatin1String("type"), attributeType());
11122
if (hasAttributeNotr())
11123
writer.writeAttribute(QLatin1String("notr"), attributeNotr());
11125
if (!m_text.isEmpty())
11126
writer.writeCharacters(m_text);
11128
writer.writeEndElement();
10886
11131
QT_END_NAMESPACE