summaryrefslogtreecommitdiffstats
path: root/lib/cppparser/driver.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
commitd6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch)
treed109539636691d7b03036ca1c0ed29dbae6577cf /lib/cppparser/driver.cpp
parent3331a47a9cad24795c7440ee8107143ce444ef34 (diff)
downloadtdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz
tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/cppparser/driver.cpp')
-rw-r--r--lib/cppparser/driver.cpp180
1 files changed, 90 insertions, 90 deletions
diff --git a/lib/cppparser/driver.cpp b/lib/cppparser/driver.cpp
index a7592b97..80667a9e 100644
--- a/lib/cppparser/driver.cpp
+++ b/lib/cppparser/driver.cpp
@@ -26,17 +26,17 @@
#include <kdebug.h>
#include <klocale.h>
#include <stdlib.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qdir.h>
-#include <qdatastream.h>
-#include <qbuffer.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqdir.h>
+#include <tqdatastream.h>
+#include <tqbuffer.h>
#include <assert.h>
#include <iostream>
-// void Macro::read( QDataStream& stream ) {
+// void Macro::read( TQDataStream& stream ) {
// stream >> m_idHashValid;
// stream >> m_valueHashValid;
// stream >> m_idHash;
@@ -48,7 +48,7 @@
// stream >> m_argumentList;
// }
//
-// void Macro::write( QDataStream& stream ) const {
+// void Macro::write( TQDataStream& stream ) const {
// stream << m_idHashValid;
// stream << m_valueHashValid;
// stream << m_idHash;
@@ -77,19 +77,19 @@ class DefaultSourceProvider: public SourceProvider {
public:
DefaultSourceProvider() {}
- virtual QString contents( const QString& fileName ) {
- QString source;
+ virtual TQString contents( const TQString& fileName ) {
+ TQString source;
- QFile f( fileName );
+ TQFile f( fileName );
if ( f.open( IO_ReadOnly ) ) {
- QTextStream s( &f );
+ TQTextStream s( &f );
source = s.read();
f.close();
}
return source;
}
- virtual bool isModified( const QString& fileName ) {
+ virtual bool isModified( const TQString& fileName ) {
Q_UNUSED( fileName );
return true;
}
@@ -137,18 +137,18 @@ void Driver::reset( ) {
}
}
-QStringList Driver::getCustomIncludePath( const QString& ) {
+TQStringList Driver::getCustomIncludePath( const TQString& ) {
return includePaths();
}
void Driver::remove
- ( const QString & fileName ) {
+ ( const TQString & fileName ) {
m_dependences.remove( fileName );
m_problems.remove( fileName );
if( !isResolveDependencesEnabled() )
removeAllMacrosInFile( fileName );
- QMap<QString, ParsedFilePointer>::Iterator it = m_parsedUnits.find( fileName );
+ TQMap<TQString, ParsedFilePointer>::Iterator it = m_parsedUnits.find( fileName );
if ( it != m_parsedUnits.end() ) {
//TranslationUnitAST * unit = **it;
m_parsedUnits.remove( it );
@@ -156,7 +156,7 @@ void Driver::remove
}
}
-void Driver::removeAllMacrosInFile( const QString& fileName ) {
+void Driver::removeAllMacrosInFile( const TQString& fileName ) {
MacroMap::iterator it = m_macros.begin();
while ( it != m_macros.end() ) {
Macro m = ( *it ).second;
@@ -190,7 +190,7 @@ bool Driver::hasMacro( const HashedString& name ) {
return false;
}
-QString deepCopy( const QString& str ) {
+TQString deepCopy( const TQString& str ) {
return str;
//return str.ascii();
}
@@ -237,8 +237,8 @@ void Driver::removeMacro( const HashedString& macroName ) {
}
}
-ParsedFilePointer Driver::takeTranslationUnit( const QString& fileName ) {
- QMap<QString, ParsedFilePointer>::Iterator it = m_parsedUnits.find( fileName );
+ParsedFilePointer Driver::takeTranslationUnit( const TQString& fileName ) {
+ TQMap<TQString, ParsedFilePointer>::Iterator it = m_parsedUnits.find( fileName );
ParsedFilePointer unit( *it );
//m_parsedUnits.remove( it );
m_parsedUnits[ fileName ] = 0;
@@ -246,19 +246,19 @@ ParsedFilePointer Driver::takeTranslationUnit( const QString& fileName ) {
}
void Driver::takeTranslationUnit( const ParsedFile& file ) {
- QMap<QString, ParsedFilePointer>::Iterator it = m_parsedUnits.find( file.fileName() );
+ TQMap<TQString, ParsedFilePointer>::Iterator it = m_parsedUnits.find( file.fileName() );
m_parsedUnits[ file.fileName() ] = 0;
}
-ParsedFilePointer Driver::translationUnit( const QString& fileName ) const {
- QMap<QString, ParsedFilePointer>::ConstIterator it = m_parsedUnits.find( fileName );
+ParsedFilePointer Driver::translationUnit( const TQString& fileName ) const {
+ TQMap<TQString, ParsedFilePointer>::ConstIterator it = m_parsedUnits.find( fileName );
return it != m_parsedUnits.end() ? *it : 0;
}
class Driver::ParseHelper {
public:
- ParseHelper( const QString& fileName, bool force, Driver* driver, bool reportMessages = true, QString includedFrom = QString() ) : m_wasReset( false ), m_fileName( fileName ), m_previousFileName( driver->m_currentFileName ), m_previousLexer( driver->lexer ), m_previousParsedFile( driver->m_currentParsedFile ), m_previousCachedLexedFile( driver->m_currentLexerCache ), m_force( force ), m_driver( driver ), m_lex( m_driver ) {
- QFileInfo fileInfo( fileName );
+ ParseHelper( const TQString& fileName, bool force, Driver* driver, bool reportMessages = true, TQString includedFrom = TQString() ) : m_wasReset( false ), m_fileName( fileName ), m_previousFileName( driver->m_currentFileName ), m_previousLexer( driver->lexer ), m_previousParsedFile( driver->m_currentParsedFile ), m_previousCachedLexedFile( driver->m_currentLexerCache ), m_force( force ), m_driver( driver ), m_lex( m_driver ) {
+ TQFileInfo fileInfo( fileName );
m_driver->m_currentParsedFile = new ParsedFile( fileName, fileInfo.lastModified() );
if( !includedFrom.isEmpty() )
m_driver->m_currentParsedFile->setIncludedFrom( includedFrom );
@@ -267,7 +267,7 @@ class Driver::ParseHelper {
#endif
m_absFilePath = fileInfo.absFilePath();
- QMap<QString, ParsedFilePointer>::Iterator it = m_driver->m_parsedUnits.find( m_absFilePath );
+ TQMap<TQString, ParsedFilePointer>::Iterator it = m_driver->m_parsedUnits.find( m_absFilePath );
if ( force && it != m_driver->m_parsedUnits.end() ) {
m_driver->takeTranslationUnit( m_absFilePath );
@@ -304,7 +304,7 @@ class Driver::ParseHelper {
}
void parse() {
- QString oldMasterFileName = m_driver->m_currentMasterFileName; //Change the master-file so problems will be reported correctly
+ TQString oldMasterFileName = m_driver->m_currentMasterFileName; //Change the master-file so problems will be reported correctly
m_driver->m_currentMasterFileName = m_absFilePath;
CachedLexedFilePointer lf = m_driver->m_currentLexerCache; //Set the lexer-cache to zero, so the problems registered through addProblem go directly into the file
@@ -349,9 +349,9 @@ class Driver::ParseHelper {
private:
bool m_wasReset;
- QString m_fileName;
- QString m_absFilePath;
- QString m_previousFileName;
+ TQString m_fileName;
+ TQString m_absFilePath;
+ TQString m_previousFileName;
Lexer* m_previousLexer;
ParsedFilePointer m_previousParsedFile;
CachedLexedFilePointer m_previousCachedLexedFile;
@@ -361,15 +361,15 @@ class Driver::ParseHelper {
};
-void Driver::addDependence( const QString & fileName, const Dependence & dep ) {
+void Driver::addDependence( const TQString & fileName, const Dependence & dep ) {
// this can happen if the parser was invoked on a snippet of text and not a file
if ( fileName.isEmpty() || !m_currentParsedFile )
return;
//@todo prevent cyclic dependency-loops
- QFileInfo fileInfo( dep.first );
- QString fn = fileInfo.absFilePath();
+ TQFileInfo fileInfo( dep.first );
+ TQString fn = fileInfo.absFilePath();
if ( !depresolv ) {
findOrInsertDependenceList( fileName ).insert( fn, dep );
@@ -377,12 +377,12 @@ void Driver::addDependence( const QString & fileName, const Dependence & dep ) {
return ;
}
- QString file = findIncludeFile( dep );
+ TQString file = findIncludeFile( dep );
findOrInsertDependenceList( fileName ).insert( file, dep );
m_currentParsedFile->addIncludeFile( file, 0, dep.second == Dep_Local );
- if ( !QFile::exists( file ) ) {
+ if ( !TQFile::exists( file ) ) {
Problem p( i18n( "Could not find include file %1" ).arg( dep.first ),
lexer ? lexer->currentLine() : -1,
lexer ? lexer->currentColumn() : -1, Problem::Level_Warning );
@@ -391,7 +391,7 @@ void Driver::addDependence( const QString & fileName, const Dependence & dep ) {
}
if( m_currentLexerCache )
- m_currentLexerCache->addIncludeFile( file, QDateTime() ); ///The time will be overwritten in CachedLexedFile::merge(...)
+ m_currentLexerCache->addIncludeFile( file, TQDateTime() ); ///The time will be overwritten in CachedLexedFile::merge(...)
/**What should be done:
* 1. Lex the file to get all the macros etc.
@@ -428,7 +428,7 @@ void Driver::addDependence( const QString & fileName, const Dependence & dep ) {
h.parse();
}
-void Driver::addProblem( const QString & fileName, const Problem & problem ) {
+void Driver::addProblem( const TQString & fileName, const Problem & problem ) {
Problem p( problem );
p.setFileName( fileName );
@@ -438,31 +438,31 @@ void Driver::addProblem( const QString & fileName, const Problem & problem ) {
findOrInsertProblemList( m_currentMasterFileName ).append( problem );
}
-QMap< QString, Dependence >& Driver::findOrInsertDependenceList( const QString & fileName ) {
- QMap<QString, QMap<QString, Dependence> >::Iterator it = m_dependences.find( fileName );
+TQMap< TQString, Dependence >& Driver::findOrInsertDependenceList( const TQString & fileName ) {
+ TQMap<TQString, TQMap<TQString, Dependence> >::Iterator it = m_dependences.find( fileName );
if ( it != m_dependences.end() )
return it.data();
- QMap<QString, Dependence> l;
+ TQMap<TQString, Dependence> l;
m_dependences.insert( deepCopy( fileName ), l );
return m_dependences[ fileName ];
}
-QValueList < Problem >& Driver::findOrInsertProblemList( const QString & fileName ) {
- QMap<QString, QValueList<Problem> >::Iterator it = m_problems.find( fileName );
+TQValueList < Problem >& Driver::findOrInsertProblemList( const TQString & fileName ) {
+ TQMap<TQString, TQValueList<Problem> >::Iterator it = m_problems.find( fileName );
if ( it != m_problems.end() )
return it.data();
- QValueList<Problem> l;
+ TQValueList<Problem> l;
m_problems.insert( fileName, l );
return m_problems[ fileName ];
}
-QMap< QString, Dependence > Driver::dependences( const QString & fileName ) const {
- QMap<QString, QMap<QString, Dependence> >::ConstIterator it = m_dependences.find( fileName );
+TQMap< TQString, Dependence > Driver::dependences( const TQString & fileName ) const {
+ TQMap<TQString, TQMap<TQString, Dependence> >::ConstIterator it = m_dependences.find( fileName );
if ( it != m_dependences.end() )
return it.data();
- return QMap<QString, Dependence>();
+ return TQMap<TQString, Dependence>();
}
const Driver::MacroMap& Driver::macros() const {
@@ -475,11 +475,11 @@ void Driver::insertMacros( const MacroSet& macros ) {
}
}
-QValueList < Problem > Driver::problems( const QString & fileName ) const {
- QMap<QString, QValueList<Problem> >::ConstIterator it = m_problems.find( fileName );
+TQValueList < Problem > Driver::problems( const TQString & fileName ) const {
+ TQMap<TQString, TQValueList<Problem> >::ConstIterator it = m_problems.find( fileName );
if ( it != m_problems.end() )
return it.data();
- return QValueList<Problem>();
+ return TQValueList<Problem>();
}
void Driver::clearMacros() {
@@ -497,9 +497,9 @@ void Driver::clearParsedMacros() {
}
}
-void Driver::parseFile( const QString& fileName, bool onlyPreProcess, bool force , bool macrosGlobal )
+void Driver::parseFile( const TQString& fileName, bool onlyPreProcess, bool force , bool macrosGlobal )
{
- QString oldMasterFileName = m_currentMasterFileName;
+ TQString oldMasterFileName = m_currentMasterFileName;
m_currentMasterFileName = fileName;
//if( isResolveDependencesEnabled() )
@@ -510,7 +510,7 @@ void Driver::parseFile( const QString& fileName, bool onlyPreProcess, bool force
//Remove the problems now instead of in ParseHelper, because this way the problems reported by getCustomIncludePath(...) will not be discarded
m_problems.remove( fileName );
- QStringList oldIncludePaths = m_includePaths;
+ TQStringList oldIncludePaths = m_includePaths;
m_includePaths = getCustomIncludePath( fileName );
ParseHelper p( fileName, force, this );
@@ -520,7 +520,7 @@ void Driver::parseFile( const QString& fileName, bool onlyPreProcess, bool force
if( macrosGlobal ) {
for( MacroMap::iterator it = m_macros.begin(); it != m_macros.end(); ++it) {
if( (*it).second.fileName() == fileName ) {
- (*it).second.setFileName( QString::null );
+ (*it).second.setFileName( TQString::null );
}
}
}
@@ -665,49 +665,49 @@ void Driver::clearIncludePaths() {
m_includePaths.clear();
}
-void Driver::addIncludePath( const QString &path ) {
+void Driver::addIncludePath( const TQString &path ) {
if ( !path.stripWhiteSpace().isEmpty() )
m_includePaths << path;
}
-QString Driver::findIncludeFile( const Dependence& dep, const QString& fromFile ) {
- QString fileName = dep.first;
+TQString Driver::findIncludeFile( const Dependence& dep, const TQString& fromFile ) {
+ TQString fileName = dep.first;
if ( dep.second == Dep_Local ) {
- QString path = QFileInfo( fromFile ).dirPath( true );
- QFileInfo fileInfo( QFileInfo( path, fileName ) );
+ TQString path = TQFileInfo( fromFile ).dirPath( true );
+ TQFileInfo fileInfo( TQFileInfo( path, fileName ) );
if ( fileInfo.exists() && fileInfo.isFile() )
return fileInfo.absFilePath();
}
- QStringList includePaths = getCustomIncludePath( fromFile );
+ TQStringList includePaths = getCustomIncludePath( fromFile );
- for ( QStringList::ConstIterator it = includePaths.begin(); it != includePaths.end(); ++it ) {
- QFileInfo fileInfo( *it, fileName );
+ for ( TQStringList::ConstIterator it = includePaths.begin(); it != includePaths.end(); ++it ) {
+ TQFileInfo fileInfo( *it, fileName );
if ( fileInfo.exists() && fileInfo.isFile() )
return fileInfo.absFilePath();
}
- return QString::null;
+ return TQString::null;
}
-QString Driver::findIncludeFile( const Dependence& dep ) const {
- QString fileName = dep.first;
+TQString Driver::findIncludeFile( const Dependence& dep ) const {
+ TQString fileName = dep.first;
if ( dep.second == Dep_Local ) {
- QString path = QFileInfo( currentFileName() ).dirPath( true );
- QFileInfo fileInfo( QFileInfo( path, fileName ) );
+ TQString path = TQFileInfo( currentFileName() ).dirPath( true );
+ TQFileInfo fileInfo( TQFileInfo( path, fileName ) );
if ( fileInfo.exists() && fileInfo.isFile() )
return fileInfo.absFilePath();
}
- for ( QStringList::ConstIterator it = m_includePaths.begin(); it != m_includePaths.end(); ++it ) {
- QFileInfo fileInfo( *it, fileName );
+ for ( TQStringList::ConstIterator it = m_includePaths.begin(); it != m_includePaths.end(); ++it ) {
+ TQFileInfo fileInfo( *it, fileName );
if ( fileInfo.exists() && fileInfo.isFile() )
return fileInfo.absFilePath();
}
- return QString::null;
+ return TQString::null;
}
void Driver::setResolveDependencesEnabled( bool enabled ) {
@@ -742,7 +742,7 @@ void Driver::usingMacro( const Macro& macro ) {
//
// m_valueHash = 27 * ( HashedString::hashString( m_body ) + (m_isUndefMacro ? 1 : 0 ) );
//
-// for( QValueList<Argument>::const_iterator it = m_argumentList.begin(); it != m_argumentList.end(); ++it ) {
+// for( TQValueList<Argument>::const_iterator it = m_argumentList.begin(); it != m_argumentList.end(); ++it ) {
// a *= 19;
// m_valueHash += a * HashedString::hashString( *it );
// }
@@ -793,7 +793,7 @@ void MacroSet::computeHash() const {
}
}
-// void MacroSet::read( QDataStream& stream ) {
+// void MacroSet::read( TQDataStream& stream ) {
// stream >> m_idHashValid >> m_idHash >> m_valueHashValid >> m_valueHash;
// int cnt;
// stream >> cnt;
@@ -805,7 +805,7 @@ void MacroSet::computeHash() const {
// }
// }
//
-// void MacroSet::write( QDataStream& stream ) const {
+// void MacroSet::write( TQDataStream& stream ) const {
// stream << m_idHashValid << m_idHash << m_valueHashValid << m_valueHash;
// stream << m_usedMacros.size();
// for( Macros::const_iterator it = m_usedMacros.begin(); it != m_usedMacros.end(); ++it ) {
@@ -824,33 +824,33 @@ const MacroSet& ParsedFile::usedMacros() const {
return m_usedMacros;
}
-ParsedFile::ParsedFile( const QString& fileName, const QDateTime& timeStamp ) : m_translationUnit( 0 ), m_fileName( fileName ), m_timeStamp( timeStamp ) {
+ParsedFile::ParsedFile( const TQString& fileName, const TQDateTime& timeStamp ) : m_translationUnit( 0 ), m_fileName( fileName ), m_timeStamp( timeStamp ) {
m_includeFiles.insert( fileName );
}
-ParsedFile::ParsedFile( const QByteArray& array ) {
- QBuffer b( array );
- QDataStream d( &b );
+ParsedFile::ParsedFile( const TQByteArray& array ) {
+ TQBuffer b( array );
+ TQDataStream d( &b );
read( d );
}
-QString ParsedFile::includedFrom() const {
+TQString ParsedFile::includedFrom() const {
return m_includedFrom;
}
-void ParsedFile::setIncludedFrom( const QString& str ) {
+void ParsedFile::setIncludedFrom( const TQString& str ) {
m_includedFrom = str;
}
-QByteArray ParsedFile::serialize() const {
- QByteArray array;
- QBuffer b( array );
- QDataStream d( &b );
+TQByteArray ParsedFile::serialize() const {
+ TQByteArray array;
+ TQBuffer b( array );
+ TQDataStream d( &b );
write( d );
return array;
}
-// void ParsedFile::read( QDataStream& stream ) {
+// void ParsedFile::read( TQDataStream& stream ) {
// int directIncludeFilesCount;
// stream >> directIncludeFilesCount;
// m_directIncludeFiles.clear();
@@ -868,8 +868,8 @@ QByteArray ParsedFile::serialize() const {
// m_includeFiles.read( stream );
// }
//
-// void ParsedFile::write( QDataStream& stream ) const {
-// for( QValueList<IncludeDesc>::const_iterator it = m_directIncludeFiles.begin(); it != m_directIncludeFiles.end(); ++it ) {
+// void ParsedFile::write( TQDataStream& stream ) const {
+// for( TQValueList<IncludeDesc>::const_iterator it = m_directIncludeFiles.begin(); it != m_directIncludeFiles.end(); ++it ) {
// stream << (*it).local;
// stream << (*it).includePath;
// }
@@ -904,11 +904,11 @@ const HashedStringSet& ParsedFile::includeFiles() const {
return m_includeFiles;
}
-QString ParsedFile::fileName() const {
+TQString ParsedFile::fileName() const {
return m_fileName;
}
-QDateTime ParsedFile::timeStamp() const {
+TQDateTime ParsedFile::timeStamp() const {
return m_timeStamp;
}
@@ -916,7 +916,7 @@ void ParsedFile::addIncludeFiles( const HashedStringSet& includeFiles ) {
m_includeFiles += includeFiles;
}
-void ParsedFile::addIncludeFile( const QString& includePath, const ParsedFilePointer& parsed, bool localInclude ) {
+void ParsedFile::addIncludeFile( const TQString& includePath, const ParsedFilePointer& parsed, bool localInclude ) {
m_includeFiles.insert( includePath );
if( parsed )
m_includeFiles += parsed->includeFiles();
@@ -927,11 +927,11 @@ void ParsedFile::addIncludeFile( const QString& includePath, const ParsedFilePoi
m_directIncludeFiles << d;
}
-const QValueList<ParsedFile::IncludeDesc>& ParsedFile::directIncludeFiles() const {
+const TQValueList<ParsedFile::IncludeDesc>& ParsedFile::directIncludeFiles() const {
return m_directIncludeFiles;
}
-bool MacroSet::hasMacro( const QString& name ) const {
+bool MacroSet::hasMacro( const TQString& name ) const {
Macros::const_iterator it = m_usedMacros.find( Macro( name, "" ) );
if( it != m_usedMacros.end() ) {
return true;
@@ -949,7 +949,7 @@ bool MacroSet::hasMacro( const HashedString& name ) const {
}
}
-Macro MacroSet::macro( const QString& name ) const {
+Macro MacroSet::macro( const TQString& name ) const {
Macros::const_iterator it = m_usedMacros.find( Macro( name, "" ) );
if( it != m_usedMacros.end() ) {