diff options
| author | Tasuku Suzuki <stasuku@gmail.com> | 2013-04-15 08:27:02 +0900 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-17 09:44:22 +0200 |
| commit | d9e722d8560c07adb1852cfd061ffb23197d06fd (patch) | |
| tree | 32ead273ee4b8b4795819c0e7739fe4bc0080dcb /src/tools/qdoc/tokenizer.cpp | |
| parent | f730cd7542548d7d5fb7cd25f631e471697960c8 (diff) | |
Make qtbase compile with QT_NO_TEXTCODEC
Change-Id: I1614dc08c0dd1950020e415f37c97160431b2336
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src/tools/qdoc/tokenizer.cpp')
| -rw-r--r-- | src/tools/qdoc/tokenizer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/qdoc/tokenizer.cpp b/src/tools/qdoc/tokenizer.cpp index 3968cdb828c..224d451f4cb 100644 --- a/src/tools/qdoc/tokenizer.cpp +++ b/src/tools/qdoc/tokenizer.cpp @@ -101,7 +101,9 @@ static QRegExp *definedX = 0; static QRegExp *defines = 0; static QRegExp *falsehoods = 0; +#ifndef QT_NO_TEXTCODEC static QTextCodec *sourceCodec = 0; +#endif /* This function is a perfect hash function for the 37 keywords of C99 @@ -496,7 +498,9 @@ void Tokenizer::initialize(const Config &config) QString sourceEncoding = config.getString(CONFIG_SOURCEENCODING); if (sourceEncoding.isEmpty()) sourceEncoding = QLatin1String("ISO-8859-1"); +#ifndef QT_NO_TEXTCODEC sourceCodec = QTextCodec::codecForName(sourceEncoding.toLocal8Bit()); +#endif comment = new QRegExp("/(?:\\*.*\\*/|/.*\n|/[^\n]*$)"); comment->setMinimal(true); @@ -770,12 +774,20 @@ bool Tokenizer::isTrue(const QString &condition) QString Tokenizer::lexeme() const { +#ifndef QT_NO_TEXTCODEC return sourceCodec->toUnicode(yyLex); +#else + return QString::fromUtf8(yyLex); +#endif } QString Tokenizer::previousLexeme() const { +#ifndef QT_NO_TEXTCODEC return sourceCodec->toUnicode(yyPrevLex); +#else + return QString::fromUtf8(yyPrevLex); +#endif } QT_END_NAMESPACE |
