aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/proparser
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/proparser')
-rw-r--r--src/shared/proparser/qmakevfs.cpp20
-rw-r--r--src/shared/proparser/qmakevfs.h11
2 files changed, 30 insertions, 1 deletions
diff --git a/src/shared/proparser/qmakevfs.cpp b/src/shared/proparser/qmakevfs.cpp
index 6115a02457..4dd1192aff 100644
--- a/src/shared/proparser/qmakevfs.cpp
+++ b/src/shared/proparser/qmakevfs.cpp
@@ -32,6 +32,10 @@ using namespace QMakeInternal;
#include <qfile.h>
#include <qfileinfo.h>
+#ifndef QT_NO_TEXTCODEC
+#include <qtextcodec.h>
+#endif
+
#define fL1S(s) QString::fromLatin1(s)
QT_BEGIN_NAMESPACE
@@ -42,6 +46,9 @@ QMakeVfs::QMakeVfs()
, m_magicExisting(fL1S("existing"))
#endif
{
+#ifndef QT_NO_TEXTCODEC
+ m_textCodec = 0;
+#endif
}
bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, VfsFlags flags,
@@ -184,7 +191,11 @@ QMakeVfs::ReadResult QMakeVfs::readFile(
*errStr = fL1S("Unexpected UTF-8 BOM");
return ReadOtherError;
}
- *contents = QString::fromLocal8Bit(bcont);
+ *contents =
+#ifndef QT_NO_TEXTCODEC
+ m_textCodec ? m_textCodec->toUnicode(bcont) :
+#endif
+ QString::fromLocal8Bit(bcont);
return ReadOk;
}
@@ -242,4 +253,11 @@ void QMakeVfs::invalidateContents()
}
#endif
+#ifndef QT_NO_TEXTCODEC
+void QMakeVfs::setTextCodec(const QTextCodec *textCodec)
+{
+ m_textCodec = textCodec;
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/shared/proparser/qmakevfs.h b/src/shared/proparser/qmakevfs.h
index 02c0a6406b..b6b93fb5dd 100644
--- a/src/shared/proparser/qmakevfs.h
+++ b/src/shared/proparser/qmakevfs.h
@@ -36,6 +36,10 @@
# endif
#endif
+#ifndef QT_NO_TEXTCODEC
+QT_FORWARD_DECLARE_CLASS(QTextCodec)
+#endif
+
#ifdef PROEVALUATOR_DUAL_VFS
# ifndef PROEVALUATOR_CUMULATIVE
# error PROEVALUATOR_DUAL_VFS requires PROEVALUATOR_CUMULATIVE
@@ -79,6 +83,10 @@ public:
void invalidateContents();
#endif
+#ifndef QT_NO_TEXTCODEC
+ void setTextCodec(const QTextCodec *textCodec);
+#endif
+
private:
#ifndef PROEVALUATOR_FULL
# ifdef PROEVALUATOR_THREAD_SAFE
@@ -88,6 +96,9 @@ private:
QString m_magicMissing;
QString m_magicExisting;
#endif
+#ifndef QT_NO_TEXTCODEC
+ const QTextCodec *m_textCodec;
+#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QMakeVfs::VfsFlags)