summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/api
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@pelagicore.com>2014-07-31 13:10:37 (GMT)
committerRobert Griebl <robert.griebl@pelagicore.com>2014-08-05 12:49:11 (GMT)
commitec808b78e1b8d5cf128b3ef3e6933cb5ddd48544 (patch)
tree4f615e8188b035d306ea054edb5a6a8cde76c913 /src/xmlpatterns/api
parent50ffdf2b44342df33af0f653001d32f4478ae691 (diff)
downloadQt-ec808b78e1b8d5cf128b3ef3e6933cb5ddd48544.zip
Qt-ec808b78e1b8d5cf128b3ef3e6933cb5ddd48544.tar.gz
Qt-ec808b78e1b8d5cf128b3ef3e6933cb5ddd48544.tar.bz2
Fix at lot of QT_NO_ define guards for very tiny Qt builds.
Change-Id: If33639be245a1ad3782e1fde279371f330a988be Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/xmlpatterns/api')
-rw-r--r--src/xmlpatterns/api/qxmlserializer.cpp21
-rw-r--r--src/xmlpatterns/api/qxmlserializer.h2
-rw-r--r--src/xmlpatterns/api/qxmlserializer_p.h2
3 files changed, 25 insertions, 0 deletions
diff --git a/src/xmlpatterns/api/qxmlserializer.cpp b/src/xmlpatterns/api/qxmlserializer.cpp
index 0ad097a..7c90b50 100644
--- a/src/xmlpatterns/api/qxmlserializer.cpp
+++ b/src/xmlpatterns/api/qxmlserializer.cpp
@@ -39,6 +39,8 @@
**
****************************************************************************/
+#include <QtCore/qglobal.h>
+
#include "qdynamiccontext_p.h"
#include "qpatternistlocale_p.h"
#include "qitem_p.h"
@@ -56,7 +58,9 @@ QXmlSerializerPrivate::QXmlSerializerPrivate(const QXmlQuery &query,
state(QXmlSerializer::BeforeDocumentElement),
np(query.namePool().d),
device(outputDevice),
+#ifndef QT_NO_TEXTCODEC
codec(QTextCodec::codecForMib(106)), /* UTF-8 */
+#endif
query(query)
{
hasClosedElement.reserve(EstimatedTreeDepth);
@@ -86,8 +90,10 @@ QXmlSerializerPrivate::QXmlSerializerPrivate(const QXmlQuery &query,
namespaces.push(defNss);
+#ifndef QT_NO_TEXTCODEC
/* If we don't set this flag, QTextCodec will generate a BOM. */
converterState.flags = QTextCodec::IgnoreHeader;
+#endif
}
/*!
@@ -264,7 +270,11 @@ void QXmlSerializer::writeEscapedAttribute(const QString &toEscape)
void QXmlSerializer::write(const QString &content)
{
Q_D(QXmlSerializer);
+#ifndef QT_NO_TEXTCODEC
d->device->write(d->codec->fromUnicode(content.constData(), content.length(), &d->converterState));
+#else
+ d->device->write(content.toUtf8());
+#endif
}
/*!
@@ -280,9 +290,13 @@ void QXmlSerializer::write(const QXmlName &name)
QByteArray &mutableCell = d->nameCache[name.code()];
const QString content(d->np->toLexical(name));
+#ifndef QT_NO_TEXTCODEC
mutableCell = d->codec->fromUnicode(content.constData(),
content.length(),
&d->converterState);
+#else
+ mutableCell = content.toUtf8();
+#endif
d->device->write(mutableCell);
}
else
@@ -306,7 +320,9 @@ void QXmlSerializer::startElement(const QXmlName &name)
Q_D(QXmlSerializer);
Q_ASSERT(d->device);
Q_ASSERT(d->device->isWritable());
+#ifndef QT_NO_TEXTCODEC
Q_ASSERT(d->codec);
+#endif
Q_ASSERT(!name.isNull());
d->namespaces.push(QVector<QXmlName>());
@@ -605,6 +621,9 @@ QIODevice *QXmlSerializer::outputDevice() const
return d->device;
}
+
+#ifndef QT_NO_TEXTCODEC
+
/*!
Sets the codec the serializer will use for encoding its XML output.
The output codec is set to \a outputCodec. By default, the output
@@ -632,6 +651,8 @@ const QTextCodec *QXmlSerializer::codec() const
return d->codec;
}
+#endif // QT_NO_TEXTCODEC
+
/*!
\reimp
*/
diff --git a/src/xmlpatterns/api/qxmlserializer.h b/src/xmlpatterns/api/qxmlserializer.h
index 80b9a2d..fbc3afe 100644
--- a/src/xmlpatterns/api/qxmlserializer.h
+++ b/src/xmlpatterns/api/qxmlserializer.h
@@ -85,8 +85,10 @@ public:
QIODevice *outputDevice() const;
+#ifndef QT_NO_TEXTCODEC
void setCodec(const QTextCodec *codec);
const QTextCodec *codec() const;
+#endif
/* The members below are internal, not part of the public API, and
* unsupported. Using them leads to undefined behavior. */
diff --git a/src/xmlpatterns/api/qxmlserializer_p.h b/src/xmlpatterns/api/qxmlserializer_p.h
index e3db705..51923c8 100644
--- a/src/xmlpatterns/api/qxmlserializer_p.h
+++ b/src/xmlpatterns/api/qxmlserializer_p.h
@@ -87,8 +87,10 @@ public:
QStack<QVector<QXmlName> > namespaces;
QIODevice * device;
+#ifndef QT_NO_TEXTCODEC
const QTextCodec * codec;
QTextCodec::ConverterState converterState;
+#endif
/**
* Name cache. Since encoding QStrings are rather expensive
* operations to do, and we on top of that would have to do