Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/qdoc3/tokenizer.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4848#include <qregexp.h>
    4949#include <qstring.h>
     50#include <qtextcodec.h>
    5051
    5152#include <ctype.h>
     
    6768    "slots", "static", "struct", "template", "typedef", "typename",
    6869    "union", "unsigned", "using", "virtual", "void", "volatile",
    69     "__int64", "Q_OBJECT", "Q_OVERRIDE", "Q_PROPERTY",
     70    "__int64",
     71    "Q_OBJECT",
     72    "Q_OVERRIDE",
     73    "Q_PROPERTY",
     74    "Q_PRIVATE_PROPERTY",
    7075    "Q_DECLARE_SEQUENTIAL_ITERATOR",
    7176    "Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR",
     
    98103static QRegExp *falsehoods = 0;
    99104
     105static QTextCodec *sourceCodec = 0;
     106
    100107/*
    101108  This function is a perfect hash function for the 37 keywords of C99
     
    119126}
    120127
    121 Tokenizer::Tokenizer(const Location& loc, FILE *in)
     128Tokenizer::Tokenizer(const Location& loc, QFile &in)
    122129{
    123130    init();
    124     QFile file;
    125     file.open(in, QIODevice::ReadOnly);
    126     yyIn = file.readAll();
    127     file.close();
     131    yyIn = in.readAll();
    128132    yyPos = 0;
    129133    start(loc);
     
    483487{
    484488    QString versionSym = config.getString(CONFIG_VERSIONSYM);
     489
     490    QString sourceEncoding = config.getString(CONFIG_SOURCEENCODING);
     491    if (sourceEncoding.isEmpty())
     492        sourceEncoding = QLatin1String("ISO-8859-1");
     493    sourceCodec = QTextCodec::codecForName(sourceEncoding.toLocal8Bit());
    485494
    486495    comment = new QRegExp("/(?:\\*.*\\*/|/.*\n|/[^\n]*$)");
     
    751760}
    752761
     762QString Tokenizer::lexeme() const
     763{
     764    return sourceCodec->toUnicode(yyLex);
     765}
     766
     767QString Tokenizer::previousLexeme() const
     768{
     769    return sourceCodec->toUnicode(yyPrevLex);
     770}
     771
    753772QT_END_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.