Changeset 846 for trunk/tools/qdoc3/tokenizer.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/tools/qdoc3/tokenizer.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 48 48 #include <qregexp.h> 49 49 #include <qstring.h> 50 #include <qtextcodec.h> 50 51 51 52 #include <ctype.h> … … 67 68 "slots", "static", "struct", "template", "typedef", "typename", 68 69 "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", 70 75 "Q_DECLARE_SEQUENTIAL_ITERATOR", 71 76 "Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR", … … 98 103 static QRegExp *falsehoods = 0; 99 104 105 static QTextCodec *sourceCodec = 0; 106 100 107 /* 101 108 This function is a perfect hash function for the 37 keywords of C99 … … 119 126 } 120 127 121 Tokenizer::Tokenizer(const Location& loc, FILE *in)128 Tokenizer::Tokenizer(const Location& loc, QFile &in) 122 129 { 123 130 init(); 124 QFile file; 125 file.open(in, QIODevice::ReadOnly); 126 yyIn = file.readAll(); 127 file.close(); 131 yyIn = in.readAll(); 128 132 yyPos = 0; 129 133 start(loc); … … 483 487 { 484 488 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()); 485 494 486 495 comment = new QRegExp("/(?:\\*.*\\*/|/.*\n|/[^\n]*$)"); … … 751 760 } 752 761 762 QString Tokenizer::lexeme() const 763 { 764 return sourceCodec->toUnicode(yyLex); 765 } 766 767 QString Tokenizer::previousLexeme() const 768 { 769 return sourceCodec->toUnicode(yyPrevLex); 770 } 771 753 772 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.