From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- lib/cppparser/ast.cpp | 66 ++++++++-------- lib/cppparser/ast.h | 112 +++++++++++++------------- lib/cppparser/driver.cpp | 180 +++++++++++++++++++++--------------------- lib/cppparser/driver.h | 114 +++++++++++++------------- lib/cppparser/errors.h | 6 +- lib/cppparser/lexer.cpp | 90 ++++++++++----------- lib/cppparser/lexer.h | 98 +++++++++++------------ lib/cppparser/lexercache.cpp | 24 +++--- lib/cppparser/lexercache.h | 28 +++---- lib/cppparser/lookup.h | 4 +- lib/cppparser/macro.h | 78 +++++++++--------- lib/cppparser/parser.cpp | 16 ++-- lib/cppparser/parser.h | 34 ++++---- lib/cppparser/tree_parser.cpp | 12 +-- 14 files changed, 431 insertions(+), 431 deletions(-) (limited to 'lib/cppparser') diff --git a/lib/cppparser/ast.cpp b/lib/cppparser/ast.cpp index 978d9408..209a8a99 100644 --- a/lib/cppparser/ast.cpp +++ b/lib/cppparser/ast.cpp @@ -18,10 +18,10 @@ */ #include "ast.h" -#include +#include #include -QString nodeTypeToString( int type ) +TQString nodeTypeToString( int type ) { switch( type ) { @@ -125,7 +125,7 @@ QString nodeTypeToString( int type ) return "Custom"; } - return QString::null; + return TQString::null; } @@ -232,18 +232,18 @@ void NameAST::addClassOrNamespaceName( ClassOrNamespaceNameAST::Node& classOrNam m_classOrNamespaceNameList.append( classOrNamespaceName.release() ); } -QString NameAST::text() const +TQString NameAST::text() const { if( !m_unqualifiedName.get() ) - return QString::null; + return TQString::null; - QString str; + TQString str; if( m_global ) str += "::"; - QStringList l; - QPtrListIterator it( m_classOrNamespaceNameList ); + TQStringList l; + TQPtrListIterator it( m_classOrNamespaceNameList ); while( it.current() ){ str += it.current()->text() + "::"; ++it; @@ -414,11 +414,11 @@ void TemplateArgumentListAST::addArgument( AST::Node& arg ) m_argumentList.append( arg.release() ); } -QString TemplateArgumentListAST::text() const +TQString TemplateArgumentListAST::text() const { - QStringList l; + TQStringList l; - QPtrListIterator it( m_argumentList ); + TQPtrListIterator it( m_argumentList ); while( it.current() ){ l.append( it.current()->text() ); ++it; @@ -467,14 +467,14 @@ void ClassOrNamespaceNameAST::setTemplateArgumentList( TemplateArgumentListAST:: if( m_templateArgumentList.get() ) m_templateArgumentList->setParent( this ); } -QString ClassOrNamespaceNameAST::text() const +TQString ClassOrNamespaceNameAST::text() const { if( !m_name.get() ) - return QString::null; + return TQString::null; - QString str = m_name->text(); + TQString str = m_name->text(); if( m_templateArgumentList.get() ) - str += QString::fromLatin1("< ") + m_templateArgumentList->text() + QString::fromLatin1(" >"); + str += TQString::fromLatin1("< ") + m_templateArgumentList->text() + TQString::fromLatin1(" >"); return str; } @@ -496,9 +496,9 @@ void TypeSpecifierAST::setCv2Qualify( GroupAST::Node& cv2Qualify ) if( m_cv2Qualify.get() ) m_cv2Qualify->setParent( this ); } -QString TypeSpecifierAST::text() const +TQString TypeSpecifierAST::text() const { - QString str; + TQString str; if( m_cvQualify.get() ) str += m_cvQualify->text() + " "; @@ -507,7 +507,7 @@ QString TypeSpecifierAST::text() const str += m_name->text(); if( m_cv2Qualify.get() ) - str += QString(" ") + m_cv2Qualify->text(); + str += TQString(" ") + m_cv2Qualify->text(); return str; } @@ -566,7 +566,7 @@ void ElaboratedTypeSpecifierAST::setKind( AST::Node& kind ) if( m_kind.get() ) m_kind->setParent( this ); } -QString ElaboratedTypeSpecifierAST::text() const +TQString ElaboratedTypeSpecifierAST::text() const { if( m_kind.get() ) return m_kind->text() + " " + TypeSpecifierAST::text(); @@ -1040,9 +1040,9 @@ void ParameterDeclarationAST::setExpression( AST::Node& expression ) if( m_expression.get() ) m_expression->setParent( this ); } -QString ParameterDeclarationAST::text() const +TQString ParameterDeclarationAST::text() const { - QString str; + TQString str; if( m_typeSpec.get() ) str += m_typeSpec->text() + " "; @@ -1050,7 +1050,7 @@ QString ParameterDeclarationAST::text() const str += m_declarator->text(); if( m_expression.get() ) - str += QString( " = " ) + m_expression->text(); + str += TQString( " = " ) + m_expression->text(); return str; } @@ -1070,11 +1070,11 @@ void ParameterDeclarationListAST::addParameter( ParameterDeclarationAST::Node& p m_parameterList.append( parameter.release() ); } -QString ParameterDeclarationListAST::text() const +TQString ParameterDeclarationListAST::text() const { - QStringList l; + TQStringList l; - QPtrListIterator it( m_parameterList ); + TQPtrListIterator it( m_parameterList ); while( it.current() ){ l.append( it.current()->text() ); ++it; @@ -1101,9 +1101,9 @@ void ParameterDeclarationClauseAST::setEllipsis( AST::Node& ellipsis ) if( m_ellipsis.get() ) m_ellipsis->setParent( this ); } -QString ParameterDeclarationClauseAST::text() const +TQString ParameterDeclarationClauseAST::text() const { - QString str; + TQString str; if( m_parameterDeclarationList.get() ) str += m_parameterDeclarationList->text(); @@ -1130,11 +1130,11 @@ void GroupAST::addNode( AST::Node& node ) m_nodeList.append( node.release() ); } -QString GroupAST::text() const +TQString GroupAST::text() const { - QStringList l; + TQStringList l; - QPtrListIterator it( m_nodeList ); + TQPtrListIterator it( m_nodeList ); while( it.current() ){ l.append( it.current()->text() ); ++it; @@ -1158,11 +1158,11 @@ void AccessDeclarationAST::addAccess( AST::Node& access ) m_accessList.append( access.release() ); } -QString AccessDeclarationAST::text() const +TQString AccessDeclarationAST::text() const { - QStringList l; + TQStringList l; - QPtrListIterator it( m_accessList ); + TQPtrListIterator it( m_accessList ); while( it.current() ){ l.append( it.current()->text() ); ++it; diff --git a/lib/cppparser/ast.h b/lib/cppparser/ast.h index b8756bf3..c9750faf 100644 --- a/lib/cppparser/ast.h +++ b/lib/cppparser/ast.h @@ -21,9 +21,9 @@ #define __ast_h #include -#include -#include -#include +#include +#include +#include #include #if defined( Q_OS_WIN32 ) || defined( Q_CC_SUN ) @@ -180,7 +180,7 @@ enum NodeType NodeType_Custom = 2000 }; -QString nodeTypeToString( int type ); +TQString nodeTypeToString( int type ); #if defined(CPPPARSER_QUICK_ALLOCATOR) @@ -205,7 +205,7 @@ QString nodeTypeToString( int type ); struct Slice { - QString source; + TQString source; int position; int length; @@ -215,13 +215,13 @@ struct Slice class CommentAST { - QString m_comment; + TQString m_comment; public: - void setComment( const QString& comment ) { + void setComment( const TQString& comment ) { m_comment = comment; } - void addComment( const QString& comment ) { + void addComment( const TQString& comment ) { if( !m_comment.isEmpty() ) { m_comment += "\n(" + comment + ")"; } else { @@ -229,7 +229,7 @@ class CommentAST { } } - QString comment() const { + TQString comment() const { return m_comment; } @@ -263,18 +263,18 @@ public: void getEndPosition( int* line, int* col ) const; #ifndef CPPPARSER_NO_CHILDREN - QPtrList children() { return m_children; } + TQPtrList children() { return m_children; } void appendChild( AST* child ); void removeChild( AST* child ); #endif - virtual inline QString text() const + virtual inline TQString text() const { return m_slice.source.mid(m_slice.position, m_slice.length); } inline void setSlice( const Slice& slice ) { m_slice = slice; } - inline void setSlice( const QString &text, int position, int length ) + inline void setSlice( const TQString &text, int position, int length ) { CommentAST a; m_slice.source = text; @@ -282,7 +282,7 @@ public: m_slice.length = length; } - inline void setText(const QString &text) + inline void setText(const TQString &text) { setSlice(text, 0, text.length()); } private: @@ -292,7 +292,7 @@ private: int m_endLine, m_endColumn; Slice m_slice; #ifndef CPPPARSER_NO_CHILDREN - QPtrList m_children; + TQPtrList m_children; #endif private: @@ -311,13 +311,13 @@ public: public: GroupAST(); - QPtrList nodeList() { return m_nodeList; } + TQPtrList nodeList() { return m_nodeList; } void addNode( AST::Node& node ); - virtual QString text() const; + virtual TQString text() const; private: - QPtrList m_nodeList; + TQPtrList m_nodeList; private: GroupAST( const GroupAST& source ); @@ -337,12 +337,12 @@ public: TemplateArgumentListAST(); void addArgument( AST::Node& arg ); - QPtrList argumentList() { return m_argumentList; } + TQPtrList argumentList() { return m_argumentList; } - virtual QString text() const; + virtual TQString text() const; private: - QPtrList m_argumentList; + TQPtrList m_argumentList; private: TemplateArgumentListAST( const TemplateArgumentListAST& source ); @@ -366,7 +366,7 @@ public: TemplateArgumentListAST* templateArgumentList() { return m_templateArgumentList.get(); } void setTemplateArgumentList( TemplateArgumentListAST::Node& templateArgumentList ); - virtual QString text() const; + virtual TQString text() const; private: AST::Node m_name; @@ -392,17 +392,17 @@ public: void setGlobal( bool b ); void addClassOrNamespaceName( ClassOrNamespaceNameAST::Node& classOrNamespaceName ); - QPtrList classOrNamespaceNameList() { return m_classOrNamespaceNameList; } + TQPtrList classOrNamespaceNameList() { return m_classOrNamespaceNameList; } ClassOrNamespaceNameAST* unqualifiedName() { return m_unqualifiedName.get(); } void setUnqualifiedName( ClassOrNamespaceNameAST::Node& unqualifiedName ); - virtual QString text() const; + virtual TQString text() const; private: bool m_global; ClassOrNamespaceNameAST::Node m_unqualifiedName; - QPtrList m_classOrNamespaceNameList; + TQPtrList m_classOrNamespaceNameList; private: NameAST( const NameAST& source ); @@ -470,13 +470,13 @@ public: public: AccessDeclarationAST(); - QPtrList accessList() { return m_accessList; } + TQPtrList accessList() { return m_accessList; } void addAccess( AST::Node& access ); - virtual QString text() const; + virtual TQString text() const; private: - QPtrList m_accessList; + TQPtrList m_accessList; private: AccessDeclarationAST( const AccessDeclarationAST& source ); @@ -503,7 +503,7 @@ public: GroupAST* cv2Qualify() { return m_cv2Qualify.get(); } void setCv2Qualify( GroupAST::Node& cv2Qualify ); - virtual QString text() const; + virtual TQString text() const; private: NameAST::Node m_name; @@ -557,10 +557,10 @@ public: BaseClauseAST(); void addBaseSpecifier( BaseSpecifierAST::Node& baseSpecifier ); - QPtrList baseSpecifierList() { return m_baseSpecifierList; } + TQPtrList baseSpecifierList() { return m_baseSpecifierList; } private: - QPtrList m_baseSpecifierList; + TQPtrList m_baseSpecifierList; private: BaseClauseAST( const BaseClauseAST& source ); @@ -587,14 +587,14 @@ public: BaseClauseAST* baseClause() { return m_baseClause.get(); } void setBaseClause( BaseClauseAST::Node& baseClause ); - QPtrList declarationList() { return m_declarationList; } + TQPtrList declarationList() { return m_declarationList; } void addDeclaration( DeclarationAST::Node& declaration ); private: GroupAST::Node m_winDeclSpec; AST::Node m_classKey; BaseClauseAST::Node m_baseClause; - QPtrList m_declarationList; + TQPtrList m_declarationList; private: ClassSpecifierAST( const ClassSpecifierAST& source ); void operator = ( const ClassSpecifierAST& source ); @@ -638,10 +638,10 @@ public: EnumSpecifierAST(); void addEnumerator( EnumeratorAST::Node& enumerator ); - QPtrList enumeratorList() { return m_enumeratorList; } + TQPtrList enumeratorList() { return m_enumeratorList; } private: - QPtrList m_enumeratorList; + TQPtrList m_enumeratorList; private: EnumSpecifierAST( const EnumSpecifierAST& source ); @@ -662,7 +662,7 @@ public: AST* kind() { return m_kind.get(); } void setKind( AST::Node& kind ); - virtual QString text() const; + virtual TQString text() const; private: AST::Node m_kind; @@ -685,10 +685,10 @@ public: LinkageBodyAST(); void addDeclaration( DeclarationAST::Node& ast ); - QPtrList declarationList() { return m_declarationList; } + TQPtrList declarationList() { return m_declarationList; } private: - QPtrList m_declarationList; + TQPtrList m_declarationList; private: LinkageBodyAST( const LinkageBodyAST& source ); @@ -836,7 +836,7 @@ public: public: DeclaratorAST(); - QPtrList ptrOpList() { return m_ptrOpList; } + TQPtrList ptrOpList() { return m_ptrOpList; } void addPtrOp( AST::Node& ptrOp ); DeclaratorAST* subDeclarator() { return m_subDeclarator.get(); } @@ -848,7 +848,7 @@ public: AST* bitfieldInitialization() { return m_bitfieldInitialization.get(); } void setBitfieldInitialization( AST::Node& bitfieldInitialization ); - QPtrList arrayDimensionList() { return m_arrayDimensionList; } + TQPtrList arrayDimensionList() { return m_arrayDimensionList; } void addArrayDimension( AST::Node& arrayDimension ); class ParameterDeclarationClauseAST* parameterDeclarationClause() { return m_parameterDeclarationClause.get(); } @@ -862,11 +862,11 @@ public: void setExceptionSpecification( GroupAST::Node& exceptionSpecification ); private: - QPtrList m_ptrOpList; + TQPtrList m_ptrOpList; AUTO_PTR m_subDeclarator; NameAST::Node m_declaratorId; AST::Node m_bitfieldInitialization; - QPtrList m_arrayDimensionList; + TQPtrList m_arrayDimensionList; AUTO_PTR m_parameterDeclarationClause; AST::Node m_constant; GroupAST::Node m_exceptionSpecification; @@ -896,7 +896,7 @@ public: AST* expression() { return m_expression.get(); } void setExpression( AST::Node& expression ); - virtual QString text() const; + virtual TQString text() const; private: TypeSpecifierAST::Node m_typeSpec; @@ -919,13 +919,13 @@ public: public: ParameterDeclarationListAST(); - QPtrList parameterList() { return m_parameterList; } + TQPtrList parameterList() { return m_parameterList; } void addParameter( ParameterDeclarationAST::Node& parameter ); - virtual QString text() const; + virtual TQString text() const; private: - QPtrList m_parameterList; + TQPtrList m_parameterList; private: ParameterDeclarationListAST( const ParameterDeclarationListAST& source ); @@ -949,7 +949,7 @@ public: AST* ellipsis() { return m_ellipsis.get(); } void setEllipsis( AST::Node& ellipsis ); - virtual QString text() const; + virtual TQString text() const; private: ParameterDeclarationListAST::Node m_parameterDeclarationList; @@ -998,11 +998,11 @@ public: public: InitDeclaratorListAST(); - QPtrList initDeclaratorList() { return m_initDeclaratorList; } + TQPtrList initDeclaratorList() { return m_initDeclaratorList; } void addInitDeclarator( InitDeclaratorAST::Node& decl ); private: - QPtrList m_initDeclaratorList; + TQPtrList m_initDeclaratorList; private: InitDeclaratorListAST( const InitDeclaratorListAST& source ); @@ -1072,11 +1072,11 @@ public: public: TemplateParameterListAST(); - QPtrList templateParameterList() { return m_templateParameterList; } + TQPtrList templateParameterList() { return m_templateParameterList; } void addTemplateParameter( TemplateParameterAST::Node& templateParameter ); private: - QPtrList m_templateParameterList; + TQPtrList m_templateParameterList; private: TemplateParameterListAST( const TemplateParameterListAST& source ); @@ -1403,11 +1403,11 @@ public: public: StatementListAST(); - QPtrList statementList() { return m_statementList; } + TQPtrList statementList() { return m_statementList; } void addStatement( StatementAST::Node& statement ); private: - QPtrList m_statementList; + TQPtrList m_statementList; private: StatementListAST( const StatementListAST& source ); @@ -1451,11 +1451,11 @@ public: public: CatchStatementListAST(); - QPtrList statementList() { return m_statementList; } + TQPtrList statementList() { return m_statementList; } void addStatement( CatchStatementAST::Node& statement ); private: - QPtrList m_statementList; + TQPtrList m_statementList; private: CatchStatementListAST( const CatchStatementListAST& source ); @@ -1565,10 +1565,10 @@ public: TranslationUnitAST(); void addDeclaration( DeclarationAST::Node& ast ); - QPtrList declarationList() { return m_declarationList; } + TQPtrList declarationList() { return m_declarationList; } private: - QPtrList m_declarationList; + TQPtrList m_declarationList; private: TranslationUnitAST( const TranslationUnitAST& source ); 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 #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -// 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::Iterator it = m_parsedUnits.find( fileName ); + TQMap::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::Iterator it = m_parsedUnits.find( fileName ); +ParsedFilePointer Driver::takeTranslationUnit( const TQString& fileName ) { + TQMap::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::Iterator it = m_parsedUnits.find( file.fileName() ); + TQMap::Iterator it = m_parsedUnits.find( file.fileName() ); m_parsedUnits[ file.fileName() ] = 0; } -ParsedFilePointer Driver::translationUnit( const QString& fileName ) const { - QMap::ConstIterator it = m_parsedUnits.find( fileName ); +ParsedFilePointer Driver::translationUnit( const TQString& fileName ) const { + TQMap::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::Iterator it = m_driver->m_parsedUnits.find( m_absFilePath ); + TQMap::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 >::Iterator it = m_dependences.find( fileName ); +TQMap< TQString, Dependence >& Driver::findOrInsertDependenceList( const TQString & fileName ) { + TQMap >::Iterator it = m_dependences.find( fileName ); if ( it != m_dependences.end() ) return it.data(); - QMap l; + TQMap l; m_dependences.insert( deepCopy( fileName ), l ); return m_dependences[ fileName ]; } -QValueList < Problem >& Driver::findOrInsertProblemList( const QString & fileName ) { - QMap >::Iterator it = m_problems.find( fileName ); +TQValueList < Problem >& Driver::findOrInsertProblemList( const TQString & fileName ) { + TQMap >::Iterator it = m_problems.find( fileName ); if ( it != m_problems.end() ) return it.data(); - QValueList l; + TQValueList l; m_problems.insert( fileName, l ); return m_problems[ fileName ]; } -QMap< QString, Dependence > Driver::dependences( const QString & fileName ) const { - QMap >::ConstIterator it = m_dependences.find( fileName ); +TQMap< TQString, Dependence > Driver::dependences( const TQString & fileName ) const { + TQMap >::ConstIterator it = m_dependences.find( fileName ); if ( it != m_dependences.end() ) return it.data(); - return QMap(); + return TQMap(); } 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 >::ConstIterator it = m_problems.find( fileName ); +TQValueList < Problem > Driver::problems( const TQString & fileName ) const { + TQMap >::ConstIterator it = m_problems.find( fileName ); if ( it != m_problems.end() ) return it.data(); - return QValueList(); + return TQValueList(); } 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::const_iterator it = m_argumentList.begin(); it != m_argumentList.end(); ++it ) { +// for( TQValueList::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::const_iterator it = m_directIncludeFiles.begin(); it != m_directIncludeFiles.end(); ++it ) { +// void ParsedFile::write( TQDataStream& stream ) const { +// for( TQValueList::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::directIncludeFiles() const { +const TQValueList& 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() ) { diff --git a/lib/cppparser/driver.h b/lib/cppparser/driver.h index 826375e3..3c12d34c 100644 --- a/lib/cppparser/driver.h +++ b/lib/cppparser/driver.h @@ -23,14 +23,14 @@ #include "ast.h" #include "macro.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -49,7 +49,7 @@ enum Dep_Local }; -typedef QPair Dependence; +typedef QPair Dependence; class ParsedFile; typedef KSharedPtr< ParsedFile > ParsedFilePointer; @@ -58,19 +58,19 @@ class ParsedFile : public AbstractParseResult { public: struct IncludeDesc { bool local; //Whether it is a local include(#include "local.h", not #include ) - QString includePath; + TQString includePath; ParsedFilePointer parsed; //May be zero! }; // ParsedFile() { // } - ParsedFile( QDataStream& s ) { + ParsedFile( TQDataStream& s ) { read( s ); } - ParsedFile( const QString& fileName, const QDateTime& timeStamp ); + ParsedFile( const TQString& fileName, const TQDateTime& timeStamp ); ///Deserializes the ParsedFile from a previous call to serialize(). AST will always be zero after a call to this. - ParsedFile( const QByteArray& array ); + ParsedFile( const TQByteArray& array ); /** * @return All Macros that were used while processing this translation-unit. May be modified. @@ -93,16 +93,16 @@ class ParsedFile : public AbstractParseResult { void addIncludeFiles( const HashedStringSet& includeFiles ); - void addIncludeFile( const QString& includePath, const ParsedFilePointer& parsed, bool localInclude ); + void addIncludeFile( const TQString& includePath, const ParsedFilePointer& parsed, bool localInclude ); ///If this file was parsed while resolving the dependencies of another file, this returns the file this one was included from. Else returns an empty string. - QString includedFrom() const; + TQString includedFrom() const; - void setIncludedFrom( const QString& str ); + void setIncludedFrom( const TQString& str ); /** * @return Reference to the internal list of all directly included files(without those included indirectly) */ - const QValueList& directIncludeFiles() const; + const TQValueList& directIncludeFiles() const; operator TranslationUnitAST* () const; //May be zero! @@ -113,17 +113,17 @@ class ParsedFile : public AbstractParseResult { void setTranslationUnit( const TranslationUnitAST::Node& trans ); - QString fileName() const; + TQString fileName() const; - QDateTime timeStamp() const; + TQDateTime timeStamp() const; ///Serializes the content of this class into a byte-array. Note that this does not serialize the AST. - QByteArray serialize() const; + TQByteArray serialize() const; - /*void read( QDataStream& stream ); - void write( QDataStream& stream ) const;*/ + /*void read( TQDataStream& stream ); + void write( TQDataStream& stream ) const;*/ - virtual void read( QDataStream& stream ) { + virtual void read( TQDataStream& stream ) { int directIncludeFilesCount; stream >> directIncludeFilesCount; m_directIncludeFiles.clear(); @@ -145,10 +145,10 @@ class ParsedFile : public AbstractParseResult { m_includeFiles.read( stream ); } - virtual void write( QDataStream& stream ) const { + virtual void write( TQDataStream& stream ) const { int i = m_directIncludeFiles.size(); stream << i; - for( QValueList::const_iterator it = m_directIncludeFiles.begin(); it != m_directIncludeFiles.end(); ++it ) { + for( TQValueList::const_iterator it = m_directIncludeFiles.begin(); it != m_directIncludeFiles.end(); ++it ) { Q_INT8 i = (*it).local; stream << i; stream << (*it).includePath; @@ -166,14 +166,14 @@ class ParsedFile : public AbstractParseResult { } private: - QValueList m_directIncludeFiles; + TQValueList m_directIncludeFiles; MacroSet m_usedMacros; TranslationUnitAST::Node m_translationUnit; HashedStringSet m_includeFiles; int m_skippedLines; - QString m_fileName; - QDateTime m_timeStamp; - QString m_includedFrom; + TQString m_fileName; + TQDateTime m_timeStamp; + TQString m_includedFrom; }; /** @@ -188,9 +188,9 @@ class SourceProvider { * Get the contents of a file * \param fileName The name of the file to get the contents for. An absolute * path should be used. - * \return A QString that contains the contents of the file + * \return A TQString that contains the contents of the file */ - virtual QString contents( const QString& fileName ) = 0; + virtual TQString contents( const TQString& fileName ) = 0; /** * Check to see if a file has been modified @@ -199,7 +199,7 @@ class SourceProvider { * \return true if the file has been modified * \return false if the file has not been modified */ - virtual bool isModified( const QString& fileName ) = 0; + virtual bool isModified( const TQString& fileName ) = 0; private: SourceProvider( const SourceProvider& source ); @@ -239,7 +239,7 @@ class Driver { * @param force Force the parsing of the file. Defaults to false * @param macrosGlobal Should the macros be global? (Global macros are not deleted once a new translation-unit is parsed) */ - virtual void parseFile( const QString& fileName, bool onlyPreProcesss = false, bool force = false, bool macrosGlobal = false ); + virtual void parseFile( const TQString& fileName, bool onlyPreProcesss = false, bool force = false, bool macrosGlobal = false ); /** * Indicates that the file has been parsed @@ -252,14 +252,14 @@ class Driver { * @param fileName The name of the file to remove */ virtual void remove - ( const QString& fileName ); + ( const TQString& fileName ); /** * Add a dependency on another header file for @p fileName * @param fileName The file name to add the dependency for * @param dep The dependency to add */ - virtual void addDependence( const QString& fileName, const Dependence& dep ); + virtual void addDependence( const TQString& fileName, const Dependence& dep ); /** * Add a macro to the driver @@ -272,15 +272,15 @@ class Driver { * @param fileName The file name to add the problem for * @param problem The problem to add */ - virtual void addProblem( const QString& fileName, const Problem& problem ); + virtual void addProblem( const TQString& fileName, const Problem& problem ); /** * The current file name the driver is working with */ - QString currentFileName() const { + TQString currentFileName() const { return m_currentFileName; } - ParsedFilePointer takeTranslationUnit( const QString& fileName ); + ParsedFilePointer takeTranslationUnit( const TQString& fileName ); void takeTranslationUnit( const ParsedFile& file ); /** @@ -289,13 +289,13 @@ class Driver { * @return The TranslationUnitAST pointer that represents the translation unit * @return 0 if no translation unit exists for the file */ - ParsedFilePointer translationUnit( const QString& fileName ) const; + ParsedFilePointer translationUnit( const TQString& fileName ) const; /** * Get the dependencies for a file * @param fileName The file name to get dependencies for * @return The dependencies for the file */ - QMap dependences( const QString& fileName ) const; + TQMap dependences( const TQString& fileName ) const; /** * Get all the macros the driver contains * @return The macros @@ -310,7 +310,7 @@ class Driver { * @param fileName The filename to get problems for * @return The list of problems for @p fileName */ - QValueList problems( const QString& fileName ) const; + TQValueList problems( const TQString& fileName ) const; void usingString( const HashedString& str ); /** @@ -346,21 +346,21 @@ class Driver { * Remove all macros from the driver for a certain file * @param fileName The file name */ - virtual void removeAllMacrosInFile( const QString& fileName ); ///Check when this is called. It may be wrong. + virtual void removeAllMacrosInFile( const TQString& fileName ); ///Check when this is called. It may be wrong. - QStringList includePaths() const { + TQStringList includePaths() const { return m_includePaths; } - virtual QStringList getCustomIncludePath( const QString& ); + virtual TQStringList getCustomIncludePath( const TQString& ); - virtual void addIncludePath( const QString &path ); + virtual void addIncludePath( const TQString &path ); virtual void clearIncludePaths(); /// @todo remove - const QMap &parsedUnits() const { + const TQMap &parsedUnits() const { return m_parsedUnits; } @@ -391,11 +391,11 @@ class Driver { LexerCache* lexerCache(); ///This uses getCustomIncludePath(..) to resolve the include-path internally - QString findIncludeFile( const Dependence& dep, const QString& fromFile ); + TQString findIncludeFile( const Dependence& dep, const TQString& fromFile ); protected: ///This uses the state of the parser to find the include-file - QString findIncludeFile( const Dependence& dep ) const; + TQString findIncludeFile( const Dependence& dep ) const; /** * Set up the lexer. @@ -423,20 +423,20 @@ class Driver { void clearParsedMacros(); private: - QMap& findOrInsertDependenceList( const QString& fileName ); - QValueList& findOrInsertProblemList( const QString& fileName ); + TQMap& findOrInsertDependenceList( const TQString& fileName ); + TQValueList& findOrInsertProblemList( const TQString& fileName ); private: - QString m_currentFileName; - QString m_currentMasterFileName; - typedef QMap DependenceMap; - typedef QMap< QString, DependenceMap> DependencesMap; + TQString m_currentFileName; + TQString m_currentMasterFileName; + typedef TQMap DependenceMap; + typedef TQMap< TQString, DependenceMap> DependencesMap; DependencesMap m_dependences; MacroMap m_macros; - QMap< QString, QValueList > m_problems; - QMap m_parsedUnits; - QStringList m_includePaths; + TQMap< TQString, TQValueList > m_problems; + TQMap m_parsedUnits; + TQStringList m_includePaths; uint depresolv : 1; Lexer *lexer; diff --git a/lib/cppparser/errors.h b/lib/cppparser/errors.h index 813d3a3f..6751475e 100644 --- a/lib/cppparser/errors.h +++ b/lib/cppparser/errors.h @@ -20,15 +20,15 @@ #ifndef ERRORS_H #define ERRORS_H -#include +#include struct Error{ int code; int level; - QString text; + TQString text; - Error( int c, int l, const QString& s ) + Error( int c, int l, const TQString& s ) : code( c ), level( l ), text( s ) {} }; diff --git a/lib/cppparser/lexer.cpp b/lib/cppparser/lexer.cpp index 3f2ec712..97fe0dc0 100644 --- a/lib/cppparser/lexer.cpp +++ b/lib/cppparser/lexer.cpp @@ -23,12 +23,12 @@ #include #include -#include -#include -#include +#include +#include +#include #if defined( KDEVELOP_BGPARSER ) -#include +#include class KDevTread: public QThread { @@ -53,8 +53,8 @@ using namespace std; struct LexerData { - typedef QMap Scope; - typedef QValueList StaticChain; + typedef TQMap Scope; + typedef TQValueList StaticChain; StaticChain staticChain; @@ -69,13 +69,13 @@ struct LexerData staticChain.pop_front(); } - void bind( const QString& name, const QString& value ) + void bind( const TQString& name, const TQString& value ) { Q_ASSERT( staticChain.size() > 0 ); staticChain.front().insert( name, value ); } - bool hasBind( const QString& name ) const + bool hasBind( const TQString& name ) const { StaticChain::ConstIterator it = staticChain.begin(); while( it != staticChain.end() ){ @@ -89,7 +89,7 @@ struct LexerData return false; } - QString apply( const QString& name ) const + TQString apply( const TQString& name ) const { StaticChain::ConstIterator it = staticChain.begin(); while( it != staticChain.end() ){ @@ -100,7 +100,7 @@ struct LexerData return scope[ name ]; } - return QString::null; + return TQString::null; } }; @@ -126,7 +126,7 @@ Lexer::~Lexer() delete( d ); } -void Lexer::setSource( const QString& source ) +void Lexer::setSource( const TQString& source ) { reset(); m_source = source; @@ -136,7 +136,7 @@ void Lexer::setSource( const QString& source ) if( !source.isEmpty() ) { m_currentChar = m_source[0]; } else { - m_currentChar = QChar::null; + m_currentChar = TQChar::null; } tokenize(); @@ -152,7 +152,7 @@ void Lexer::reset() m_index = 0; m_size = 0; m_tokens.clear(); - m_source = QString::null; + m_source = TQString::null; m_ptr = 0; m_endPtr = 0; m_startLine = false; @@ -169,12 +169,12 @@ void Lexer::reset() // ### should all be done with a "long" type IMO int Lexer::toInt( const Token& token ) { - QString s = token.text(); + TQString s = token.text(); if( token.type() == Token_number_literal ){ // hex literal ? if( s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) return s.mid( 2 ).toInt( 0, 16 ); - QString n; + TQString n; int i = 0; while( i < int(s.length()) && s[i].isDigit() ) n += s[i++]; @@ -220,8 +220,8 @@ void Lexer::nextToken( Token& tk, bool stopOnNewline ) int startLine = m_currentLine; int startColumn = m_currentColumn; - QChar ch = currentChar(); - QChar ch1 = peekChar(); + TQChar ch = currentChar(); + TQChar ch1 = peekChar(); if( ch.isNull() || ch.isSpace() ){ /* skip */ @@ -233,7 +233,7 @@ void Lexer::nextToken( Token& tk, bool stopOnNewline ) int start = currentPosition(); readIdentifier(); // read the directive - QString directive = m_source.mid( start, currentPosition() - start ); + TQString directive = m_source.mid( start, currentPosition() - start ); handleDirective( directive ); } else if( m_startLine && m_skipping[ m_ifLevel ] ){ @@ -301,7 +301,7 @@ void Lexer::nextToken( Token& tk, bool stopOnNewline ) Macro m = m_driver->macro( ide ); m_driver->usingMacro( m ); - QString ellipsisArg; + TQString ellipsisArg; if( m.hasArguments() ){ int endIde = currentPosition(); @@ -314,11 +314,11 @@ void Lexer::nextToken( Token& tk, bool stopOnNewline ) while( currentChar() && argIdxbind( argName, arg ); @@ -363,7 +363,7 @@ void Lexer::nextToken( Token& tk, bool stopOnNewline ) // tokenize the macro body - QString textToInsert; + TQString textToInsert; setEndPtr( offset( currentPosition() + m.body().length() ) ); @@ -383,24 +383,24 @@ void Lexer::nextToken( Token& tk, bool stopOnNewline ) if( tok == Token_eof ) break; - QString tokText = tok.text(); + TQString tokText = tok.text(); HashedString str = (tok == Token_identifier && d->hasBind(tokText)) ? d->apply( tokText ) : tokText; if( str == ide ){ //Problem p( i18n("unsafe use of macro '%1', macro is ignored").arg(ide.str()), m_currentLine, m_currentColumn, Problem::Level_Warning ); //m_driver->addProblem( m_driver->currentFileName(), p ); m_driver->removeMacro( ide ); - // str = QString::null; + // str = TQString::null; } if( stringify ) { - textToInsert.append( QString::fromLatin1("\"") + str.str() + QString::fromLatin1("\" ") ); + textToInsert.append( TQString::fromLatin1("\"") + str.str() + TQString::fromLatin1("\" ") ); } else if( merge ){ textToInsert.truncate( textToInsert.length() - 1 ); - textToInsert.append( str.str() + QString::fromLatin1(" ") ); + textToInsert.append( str.str() + TQString::fromLatin1(" ") ); } else if( tok == Token_ellipsis && d->hasBind("...") ){ textToInsert.append( ellipsisArg ); } else { - textToInsert.append( str.str() + QString::fromLatin1(" ") ); + textToInsert.append( str.str() + TQString::fromLatin1(" ") ); } } @@ -419,7 +419,7 @@ void Lexer::nextToken( Token& tk, bool stopOnNewline ) tk.setStartPosition( startLine, startColumn ); tk.setEndPosition( m_currentLine, m_currentColumn ); } else if( m_skipWordsEnabled ){ - __gnu_cxx::hash_map< HashedString, QPair >::iterator pos = m_words.find( ide ); + __gnu_cxx::hash_map< HashedString, QPair >::iterator pos = m_words.find( ide ); if( pos != m_words.end() ){ if( (*pos).second.first == SkipWordAndArguments ){ readWhiteSpaces(); @@ -430,7 +430,7 @@ void Lexer::nextToken( Token& tk, bool stopOnNewline ) #if defined( KDEVELOP_BGPARSER ) qthread_yield(); #endif - insertCurrent( QString(" ") + (*pos).second.second + QString(" ") ); + insertCurrent( TQString(" ") + (*pos).second.second + TQString(" ") ); } } else if( /*qt_rx.exactMatch(ide) ||*/ ide.str().endsWith("EXPORT") || @@ -512,7 +512,7 @@ void Lexer::resetSkipWords() m_words.clear(); } -void Lexer::addSkipWord( const QString& word, SkipType skipType, const QString& str ) +void Lexer::addSkipWord( const TQString& word, SkipType skipType, const TQString& str ) { m_words[ word ] = qMakePair( skipType, str ); } @@ -541,17 +541,17 @@ void Lexer::skip( int l, int r ) m_currentColumn = svCurrentColumn; } -QString Lexer::readArgument() +TQString Lexer::readArgument() { int count = 0; - QString arg; + TQString arg; readWhiteSpaces(); while( currentChar() ){ readWhiteSpaces(); - QChar ch = currentChar(); + TQChar ch = currentChar(); if( ch.isNull() || (!count && (ch == ',' || ch == ')')) ) break; @@ -572,7 +572,7 @@ QString Lexer::readArgument() return arg.stripWhiteSpace(); } -void Lexer::handleDirective( const QString& directive ) +void Lexer::handleDirective( const TQString& directive ) { m_inPreproc = true; @@ -651,7 +651,7 @@ void Lexer::processDefine( Macro& m ) int startMacroName = currentPosition(); readIdentifier(); - QString macroName = m_source.mid( startMacroName, int(currentPosition()-startMacroName) ); + TQString macroName = m_source.mid( startMacroName, int(currentPosition()-startMacroName) ); m.setName( macroName ); if( currentChar() == '(' ){ @@ -670,7 +670,7 @@ void Lexer::processDefine( Macro& m ) else readIdentifier(); - QString arg = m_source.mid( startArg, int(currentPosition()-startArg) ); + TQString arg = m_source.mid( startArg, int(currentPosition()-startArg) ); m.addArgument( Macro::Argument(arg) ); @@ -687,7 +687,7 @@ void Lexer::processDefine( Macro& m ) setPreprocessorEnabled( true ); - QString body; + TQString body; while( currentChar() && currentChar() != '\n' ){ if( currentChar().isSpace() ){ @@ -700,7 +700,7 @@ void Lexer::processDefine( Macro& m ) //Do not ignore c-style comments, those may be useful in the body, and ignoring them using this check causes problems if( tk.type() != -1 && (tk.type() != Token_comment || ( tk.text().length() >= 2 && tk.text()[1] == '*') ) ){ - QString s = tk.text(); + TQString s = tk.text(); body += s; } } @@ -792,16 +792,16 @@ void Lexer::processInclude() readWhiteSpaces( false ); if( currentChar() ){ - QChar ch = currentChar(); + TQChar ch = currentChar(); if( ch == '"' || ch == '<' ){ nextChar(); - QChar ch2 = ch == QChar('"') ? QChar('"') : QChar('>'); + TQChar ch2 = ch == TQChar('"') ? TQChar('"') : TQChar('>'); int startWord = currentPosition(); while( currentChar() && currentChar() != ch2 ) nextChar(); if( currentChar() ){ - QString word = m_source.mid( startWord, int(currentPosition()-startWord) ); + TQString word = m_source.mid( startWord, int(currentPosition()-startWord) ); m_driver->addDependence( m_driver->currentFileName(), Dependence(word, ch == '"' ? Dep_Local : Dep_Global) ); nextChar(); @@ -815,7 +815,7 @@ void Lexer::processUndef() readWhiteSpaces(); int startWord = currentPosition(); readIdentifier(); - QString word = m_source.mid( startWord, currentPosition() - startWord ); + TQString word = m_source.mid( startWord, currentPosition() - startWord ); Macro m( word, "" ); m.setFileName( m_driver->currentFileName() ); @@ -845,7 +845,7 @@ int Lexer::macroPrimary() case '!': case '~': { - QChar tk = currentChar(); + TQChar tk = currentChar(); nextChar(); int result = macroPrimary(); if( tk == '-' ) return -result; @@ -1003,7 +1003,7 @@ int Lexer::macroLogicalAnd() nextChar( 2 ); int start = currentPosition(); result = macroBoolOr() && result; - QString s = m_source.mid( start, currentPosition() - start ); + TQString s = m_source.mid( start, currentPosition() - start ); } return result; } @@ -1026,7 +1026,7 @@ int Lexer::macroExpression() } // *IMPORTANT* -// please, don't include lexer.moc here, because Lexer isn't a QObject class!! +// please, don't include lexer.moc here, because Lexer isn't a TQObject class!! // if you have problem while recompiling try to remove cppsupport/.deps, // cppsupport/Makefile.in and rerun automake/autoconf diff --git a/lib/cppparser/lexer.h b/lib/cppparser/lexer.h index 08681a4d..a94e5c5e 100644 --- a/lib/cppparser/lexer.h +++ b/lib/cppparser/lexer.h @@ -22,11 +22,11 @@ #include "driver.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -151,8 +151,8 @@ struct LexerData; class Token { - Token(const QString &); - Token( int type, int position, int length, const QString& text ); + Token(const TQString &); + Token( int type, int position, int length, const TQString& text ); Token( const Token& source ); Token& operator = ( const Token& source ); @@ -176,7 +176,7 @@ public: int position() const; void setPosition( int position ); - QString text() const; + TQString text() const; private: int m_type; @@ -186,7 +186,7 @@ private: int m_startColumn; int m_endLine; int m_endColumn; - const QString & m_text; + const TQString & m_text; friend class Lexer; friend class Parser; @@ -217,10 +217,10 @@ public: void setPreprocessorEnabled( bool enabled ); void resetSkipWords(); - void addSkipWord( const QString& word, SkipType skipType=SkipWord, const QString& str = QString::null ); + void addSkipWord( const TQString& word, SkipType skipType=SkipWord, const TQString& str = TQString::null ); - QString source() const; - void setSource( const QString& source ); + TQString source() const; + void setSource( const TQString& source ); int index() const; void setIndex( int index ); @@ -246,23 +246,23 @@ public: return m_source.unicode() + offset; } - inline int getOffset( const QChar* p ) const { + inline int getOffset( const TQChar* p ) const { return int(p - (m_source.unicode())); } private: - void setEndPtr( const QChar* c ) { + void setEndPtr( const TQChar* c ) { m_endPtr = c; if( m_ptr < m_endPtr ) m_currentChar = *m_ptr; else - m_currentChar = QChar::null; + m_currentChar = TQChar::null; } - const QChar currentChar() const; - QChar peekChar( int n=1 ) const; + const TQChar currentChar() const; + TQChar peekChar( int n=1 ) const; int currentPosition() const; - void insertCurrent( const QString& str ); + void insertCurrent( const TQString& str ); void tokenize(); void nextToken( Token& token, bool stopOnNewline=false ); @@ -284,7 +284,7 @@ private: // preprocessor (based on an article of Al Stevens on Dr.Dobb's journal) int testIfLevel(); int macroDefined(); - QString readArgument(); + TQString readArgument(); int macroPrimary(); int macroMultiplyDivide(); @@ -298,7 +298,7 @@ private: int macroLogicalOr(); int macroExpression(); - void handleDirective( const QString& directive ); + void handleDirective( const TQString& directive ); void processDefine( Macro& macro ); void processElse(); void processElif(); @@ -312,17 +312,17 @@ private: private: LexerData* d; Driver* m_driver; - QPtrVector< Token > m_tokens; + TQPtrVector< Token > m_tokens; int m_size; int m_index; - QString m_source; - const QChar* m_ptr; - const QChar* m_endPtr; - QChar m_currentChar; + TQString m_source; + const TQChar* m_ptr; + const TQChar* m_endPtr; + TQChar m_currentChar; bool m_recordComments; bool m_recordWhiteSpaces; bool m_startLine; - __gnu_cxx::hash_map< HashedString, QPair > m_words; + __gnu_cxx::hash_map< HashedString, QPair > m_words; int m_skippedLines; @@ -331,8 +331,8 @@ private: bool m_skipWordsEnabled; // preprocessor - QMemArray m_skipping; - QMemArray m_trueTest; + TQMemArray m_skipping; + TQMemArray m_trueTest; int m_ifLevel; bool m_preprocessorEnabled; bool m_inPreproc; @@ -346,7 +346,7 @@ private: }; -inline Token::Token(const QString & text = "") +inline Token::Token(const TQString & text = "") : m_type( -1 ), m_position( 0 ), m_length( 0 ), @@ -354,7 +354,7 @@ inline Token::Token(const QString & text = "") { } -inline Token::Token( int type, int position, int length, const QString& text ) +inline Token::Token( int type, int position, int length, const TQString& text ) : m_type( type ), m_position( position ), m_length( length ), @@ -424,7 +424,7 @@ inline int Token::position() const return m_position; } -inline QString Token::text() const +inline TQString Token::text() const { return m_text.mid(m_position, m_length); } @@ -488,7 +488,7 @@ inline void Lexer::setRecordWhiteSpaces( bool record ) m_recordWhiteSpaces = record; } -inline QString Lexer::source() const +inline TQString Lexer::source() const { return m_source; } @@ -540,7 +540,7 @@ inline void Lexer::nextChar() if( m_ptr < m_endPtr ) m_currentChar = *m_ptr; else - m_currentChar = QChar::null; + m_currentChar = TQChar::null; } inline void Lexer::nextChar( int n ) @@ -551,7 +551,7 @@ inline void Lexer::nextChar( int n ) if( m_ptr < m_endPtr ) m_currentChar = *m_ptr; else - m_currentChar = QChar::null; + m_currentChar = TQChar::null; } inline void Lexer::readIdentifier() @@ -563,7 +563,7 @@ inline void Lexer::readIdentifier() inline void Lexer::readWhiteSpaces( bool skipNewLine, bool skipOnlyOnce ) { while( !currentChar().isNull() ){ - QChar ch = currentChar(); + TQChar ch = currentChar(); if( ch == '\n' && !skipNewLine ){ break; @@ -582,7 +582,7 @@ inline void Lexer::readWhiteSpaces( bool skipNewLine, bool skipOnlyOnce ) } //little hack for better performance -inline bool isTodo( const QString& txt, int position ) { +inline bool isTodo( const TQString& txt, int position ) { if( txt.length() < position + 4 ) return false; return (txt[ position ] == 't' || txt[ position ] == 'T') && (txt[ position+1 ] == 'o' || txt[ position+1 ] == 'O') @@ -590,7 +590,7 @@ inline bool isTodo( const QString& txt, int position ) { && (txt[ position+3 ] == 'o' || txt[ position+3 ] == 'O'); } -inline bool isFixme( const QString& txt, int position ) { +inline bool isFixme( const TQString& txt, int position ) { if( txt.length() < position + 5 ) return false; return (txt[ position ] == 'f' || txt[ position ] == 'F') && (txt[ position+1 ] == 'i' || txt[ position+1 ] == 'I') @@ -604,7 +604,7 @@ inline void Lexer::readLineComment() while( !currentChar().isNull() && currentChar() != '\n' ){ if( m_reportMessages && isTodo( m_source, currentPosition() ) ){ nextChar( 4 ); - QString msg; + TQString msg; int line = m_currentLine; int col = m_currentColumn; @@ -621,7 +621,7 @@ inline void Lexer::readLineComment() } else if( m_reportMessages && isFixme( m_source, currentPosition() ) ){ nextChar( 5 ); - QString msg; + TQString msg; int line = m_currentLine; int col = m_currentColumn; @@ -648,7 +648,7 @@ inline void Lexer::readMultiLineComment() return; } else if( m_reportMessages && isTodo( m_source, currentPosition() ) ){ nextChar( 4 ); - QString msg; + TQString msg; int line = m_currentLine; int col = m_currentColumn; @@ -664,7 +664,7 @@ inline void Lexer::readMultiLineComment() } else if( m_reportMessages && isFixme( m_source, currentPosition() ) ) { nextChar( 5 ); - QString msg; + TQString msg; int line = m_currentLine; int col = m_currentColumn; @@ -742,7 +742,7 @@ inline int Lexer::findOperator3() const int n = getOffset( m_endPtr ) - currentPosition(); if( n >= 3){ - QChar ch = currentChar(), ch1=peekChar(), ch2=peekChar(2); + TQChar ch = currentChar(), ch1=peekChar(), ch2=peekChar(2); if( ch == '<' && ch1 == '<' && ch2 == '=' ) return Token_assign; else if( ch == '>' && ch1 == '>' && ch2 == '=' ) return Token_assign; @@ -758,7 +758,7 @@ inline int Lexer::findOperator2() const int n = getOffset( m_endPtr ) - currentPosition(); if( n>=2 ){ - QChar ch = currentChar(), ch1=peekChar(); + TQChar ch = currentChar(), ch1=peekChar(); if( ch == ':' && ch1 == ':' ) return Token_scope; else if( ch == '.' && ch1 == '*' ) return Token_ptrmem; @@ -812,19 +812,19 @@ inline int Lexer::currentPosition() const return getOffset( m_ptr ); } -inline const QChar Lexer::currentChar() const +inline const TQChar Lexer::currentChar() const { return m_currentChar; } -inline QChar Lexer::peekChar( int n ) const +inline TQChar Lexer::peekChar( int n ) const { - const QChar* p = m_ptr + n; + const TQChar* p = m_ptr + n; if( p < m_endPtr ) return *p; else - return QChar::null; + return TQChar::null; } inline bool Lexer::eof() const @@ -852,7 +852,7 @@ inline void Lexer::setReportMessages( bool enable ) m_reportMessages = enable; } -inline void Lexer::insertCurrent( const QString& str ) { +inline void Lexer::insertCurrent( const TQString& str ) { int posi = currentPosition(); m_source.insert( posi, str ); @@ -861,7 +861,7 @@ inline void Lexer::insertCurrent( const QString& str ) { if( m_ptr < m_endPtr ) m_currentChar = *m_ptr; else - m_currentChar = QChar::null; + m_currentChar = TQChar::null; } #endif diff --git a/lib/cppparser/lexercache.cpp b/lib/cppparser/lexercache.cpp index a7e40dd6..230a7de1 100644 --- a/lib/cppparser/lexercache.cpp +++ b/lib/cppparser/lexercache.cpp @@ -108,7 +108,7 @@ CachedLexedFilePointer LexerCache::lexedFile( const HashedString& fileName ) { return CachedLexedFilePointer(); } -QDateTime LexerCache::fileModificationTimeCached( const HashedString& fileName ) { +TQDateTime LexerCache::fileModificationTimeCached( const HashedString& fileName ) { FileModificationMap::const_iterator it = m_fileModificationCache.find( fileName ); if( it != m_fileModificationCache.end() ) { ///Use the cache for 10 seconds @@ -117,8 +117,8 @@ QDateTime LexerCache::fileModificationTimeCached( const HashedString& fileName ) } } - QFileInfo fileInfo( fileName.str() ); - m_fileModificationCache[fileName].m_readTime = QDateTime::currentDateTime(); + TQFileInfo fileInfo( fileName.str() ); + m_fileModificationCache[fileName].m_readTime = TQDateTime::currentDateTime(); m_fileModificationCache[fileName].m_modificationTime = fileInfo.lastModified(); return fileInfo.lastModified(); @@ -128,13 +128,13 @@ QDateTime LexerCache::fileModificationTimeCached( const HashedString& fileName ) bool LexerCache::sourceChanged( const CachedLexedFile& file ) { //@todo Check if any of the dependencies changed - QDateTime modTime = fileModificationTimeCached( file.fileName() ); + TQDateTime modTime = fileModificationTimeCached( file.fileName() ); if ( modTime != file.modificationTime() ) return true; - for( QMap::const_iterator it = file.allModificationTimes().begin(); it != file.allModificationTimes().end(); ++it ) { - QDateTime modTime = fileModificationTimeCached( it.key() ); + for( TQMap::const_iterator it = file.allModificationTimes().begin(); it != file.allModificationTimes().end(); ++it ) { + TQDateTime modTime = fileModificationTimeCached( it.key() ); if( modTime != *it ) return true; } @@ -162,7 +162,7 @@ void LexerCache::erase( const CacheNode* node ) { } CachedLexedFile::CachedLexedFile( const HashedString& fileName, LexerCache* manager ) : CacheNode( manager ), m_fileName( fileName ) { - QFileInfo fileInfo( fileName.str() ); + TQFileInfo fileInfo( fileName.str() ); m_modificationTime = fileInfo.lastModified(); m_allModificationTimes[ fileName ] = m_modificationTime; } @@ -184,13 +184,13 @@ void CachedLexedFile::addUsedMacro( const Macro& macro ) { } } -void CachedLexedFile::addIncludeFile( const HashedString& file, const QDateTime& modificationTime ) { +void CachedLexedFile::addIncludeFile( const HashedString& file, const TQDateTime& modificationTime ) { m_includeFiles.insert( file ); m_allModificationTimes[file] = modificationTime; } -QDateTime CachedLexedFile::modificationTime() const { +TQDateTime CachedLexedFile::modificationTime() const { return m_modificationTime; } @@ -198,7 +198,7 @@ void CachedLexedFile::addProblem( const Problem& p ) { m_problems << p; } -QValueList CachedLexedFile::problems() const { +TQValueList CachedLexedFile::problems() const { return m_problems; } @@ -224,7 +224,7 @@ void CachedLexedFile::merge( const CachedLexedFile& file ) { m_definedMacros.merge( file.m_definedMacros ); m_definedMacroNames += file.m_definedMacroNames; - for( QMap::const_iterator it = file.m_allModificationTimes.begin(); it != file.m_allModificationTimes.end(); ++it ) + for( TQMap::const_iterator it = file.m_allModificationTimes.begin(); it != file.m_allModificationTimes.end(); ++it ) m_allModificationTimes[it.key()] = *it; @@ -239,7 +239,7 @@ size_t CachedLexedFile::hash() const { } void LexerCache::initFileModificationCache() { - m_currentDateTime = QDateTime::currentDateTime(); + m_currentDateTime = TQDateTime::currentDateTime(); } void LexerCache::saveMemory() { diff --git a/lib/cppparser/lexercache.h b/lib/cppparser/lexercache.h index c32d5406..662e0270 100644 --- a/lib/cppparser/lexercache.h +++ b/lib/cppparser/lexercache.h @@ -19,8 +19,8 @@ #include #include "macro.h" #include -#include -#include +#include +#include #include #include "cachemanager.h" @@ -43,17 +43,17 @@ class CachedLexedFile : public KShared, public CacheNode { void addUsedMacro( const Macro& macro ); - void addIncludeFile( const HashedString& file, const QDateTime& modificationTime ); + void addIncludeFile( const HashedString& file, const TQDateTime& modificationTime ); inline bool hasString( const HashedString& string ) const { return m_strings[string]; } - QDateTime modificationTime() const; + TQDateTime modificationTime() const; void addProblem( const Problem& p ); - QValueList problems() const; + TQValueList problems() const; //The parameter should be a CachedLexedFile that was lexed AFTER the content of this file void merge( const CachedLexedFile& file ); @@ -81,21 +81,21 @@ class CachedLexedFile : public KShared, public CacheNode { } ///Should contain a modification-time for each include-file - const QMap& allModificationTimes() const { + const TQMap& allModificationTimes() const { return m_allModificationTimes; } private: friend class LexerCache; HashedString m_fileName; - QDateTime m_modificationTime; + TQDateTime m_modificationTime; HashedStringSet m_strings; //Set of all strings that can be affected by macros from outside HashedStringSet m_includeFiles; //Set of all files MacroSet m_usedMacros; //Set of all macros that were used, and were defined outside of this file MacroSet m_definedMacros; //Set of all macros that were defined while lexing this file HashedStringSet m_definedMacroNames; - QValueList m_problems; - QMap m_allModificationTimes; + TQValueList m_problems; + TQMap m_allModificationTimes; /* Needed data: 1. Set of all strings that appear in this file(For memory-reasons they should be taken from a global string-repository, because many will be the same) @@ -140,22 +140,22 @@ class LexerCache : public CacheManager { virtual void saveMemory(); private: ///before this can be called, initFileModificationCache should be called once - QDateTime fileModificationTimeCached( const HashedString& fileName ); + TQDateTime fileModificationTimeCached( const HashedString& fileName ); void initFileModificationCache(); virtual void erase( const CacheNode* node ); bool sourceChanged( const CachedLexedFile& file );///Returns true if the file itself, or any of its dependencies was modified. //typedef __gnu_cxx::hash_multimap CachedLexedFileMap; typedef std::multimap CachedLexedFileMap; CachedLexedFileMap m_files; - __gnu_cxx::hash_set m_totalStringSet; ///This is used to reduce memory-usage: Most strings appear again and again. Because QString is reference-counted, this set contains a unique copy of each string to used for each appearance of the string + __gnu_cxx::hash_set m_totalStringSet; ///This is used to reduce memory-usage: Most strings appear again and again. Because TQString is reference-counted, this set contains a unique copy of each string to used for each appearance of the string struct FileModificationCache { - QDateTime m_readTime; - QDateTime m_modificationTime; + TQDateTime m_readTime; + TQDateTime m_modificationTime; }; typedef __gnu_cxx::hash_map FileModificationMap; FileModificationMap m_fileModificationCache; Driver* m_driver; - QDateTime m_currentDateTime; + TQDateTime m_currentDateTime; }; diff --git a/lib/cppparser/lookup.h b/lib/cppparser/lookup.h index 0fabd010..54bbfeff 100644 --- a/lib/cppparser/lookup.h +++ b/lib/cppparser/lookup.h @@ -21,8 +21,8 @@ #ifndef _LOOKUP_H_ #define _LOOKUP_H_ -#include -#include +#include +#include #include "lexer.h" #include diff --git a/lib/cppparser/macro.h b/lib/cppparser/macro.h index 03e76984..e8fe0b9c 100644 --- a/lib/cppparser/macro.h +++ b/lib/cppparser/macro.h @@ -15,14 +15,14 @@ #ifndef MACRO_H #define MACRO_H -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -50,12 +50,12 @@ class Problem { Problem( const Problem& source ) : m_text( source.m_text ), m_line( source.m_line ), m_column( source.m_column ), m_level( source.m_level ), m_file( source.m_file ) {} - Problem( const QString& text, int line, int column, int level = Level_Error ) + Problem( const TQString& text, int line, int column, int level = Level_Error ) : m_text( text ), m_line( line ), m_column( column ), m_level( level ) {} Problem( const Problem& source, bool /*threadSafeClone*/ ) - : m_text( QString::fromUtf8( source.m_text.utf8().data() ) ), m_line( source.m_line ), - m_column( source.m_column ), m_level( source.m_level ), m_file( QString::fromUtf8( source.m_file.utf8().data() ) ) {} + : m_text( TQString::fromUtf8( source.m_text.utf8().data() ) ), m_line( source.m_line ), + m_column( source.m_column ), m_level( source.m_level ), m_file( TQString::fromUtf8( source.m_file.utf8().data() ) ) {} Problem& operator = ( const Problem& source ) { m_text = source.m_text; @@ -66,7 +66,7 @@ class Problem { return ( *this ); } - void setFileName( const QString& fileName ) { + void setFileName( const TQString& fileName ) { m_file = fileName; } @@ -75,12 +75,12 @@ class Problem { } /** Get the filename in which the problem was encountered */ - QString fileName() const { + TQString fileName() const { return m_file; } /** Get the text for the problem */ - QString text() const { + TQString text() const { return m_text; } /** Get the line number of the problem */ @@ -103,11 +103,11 @@ class Problem { } private: - QString m_text; + TQString m_text; int m_line; int m_column; int m_level; - QString m_file; + TQString m_file; }; @@ -117,11 +117,11 @@ class Problem { */ class Macro { public: - typedef QString Argument; + typedef TQString Argument; public: Macro( bool hasArguments = false ) : m_idHashValid( false ), m_valueHashValid( false ), m_line( 0 ), m_column( 0 ), m_hasArguments( hasArguments ), m_isUndefMacro( false ) {} - Macro( const QString &n, const QString &b ) : m_idHashValid( false ), m_valueHashValid( false ), m_name( n ), m_line( 0 ), m_column( 0 ), m_body( b ), m_hasArguments( false ), m_isUndefMacro( false ) {} + Macro( const TQString &n, const TQString &b ) : m_idHashValid( false ), m_valueHashValid( false ), m_name( n ), m_line( 0 ), m_column( 0 ), m_body( b ), m_hasArguments( false ), m_isUndefMacro( false ) {} //Sorts the macros by their hash-value, then by their name. struct NameArgCompare { @@ -173,8 +173,8 @@ class Macro { return false; } else { if( lhs.m_argumentList.count() != rhs.m_argumentList.count() ) return false; - /*QStringList::const_iterator it2 = rhs.m_argumentList.begin(); - for( QStringList::const_iterator it = lhs.m_argumentList.begin(); it != lhs.m_argumentList.end(); ) { + /*TQStringList::const_iterator it2 = rhs.m_argumentList.begin(); + for( TQStringList::const_iterator it = lhs.m_argumentList.begin(); it != lhs.m_argumentList.end(); ) { if( *it != *it2 ) return false; ++it; @@ -227,7 +227,7 @@ class Macro { m_argumentList == source.m_argumentList && m_isUndefMacro == source.m_isUndefMacro; } - void read( QDataStream& stream ) { + void read( TQDataStream& stream ) { Q_INT8 i; stream >> i; m_idHashValid = i; stream >> i; m_valueHashValid = i; @@ -243,7 +243,7 @@ class Macro { stream >> m_argumentList; } - void write( QDataStream& stream ) const { + void write( TQDataStream& stream ) const { Q_INT8 i; i = m_idHashValid; stream << i; i = m_valueHashValid; stream << i; @@ -260,21 +260,21 @@ class Macro { } /** Get the name for this macro */ - QString name() const { + TQString name() const { return m_name; } /** Set the name for this macro */ - void setName( const QString& name ) { + void setName( const TQString& name ) { m_name = name; invalidateHash(); } /** Get the file name that contains this macro */ - QString fileName() const { + TQString fileName() const { return m_fileName; } /** Set the file name that contains this macro */ - void setFileName( const QString& fileName ) { + void setFileName( const TQString& fileName ) { m_fileName = fileName; invalidateHash(); } @@ -298,11 +298,11 @@ class Macro { } /** Get the body of the macro */ - QString body() const { + TQString body() const { return m_body; } /** Set the body of the macro */ - void setBody( const QString& body ) { + void setBody( const TQString& body ) { m_body = body; invalidateHash(); } @@ -326,7 +326,7 @@ class Macro { invalidateHash(); } /** Get a list of arguments passed to this macro */ - QValueList argumentList() const { + TQValueList argumentList() const { return m_argumentList; } @@ -341,7 +341,7 @@ class Macro { m_argumentList << argument; } /** Add a list of arguments to this macro */ - void addArgumentList( const QValueList& arguments ) { + void addArgumentList( const TQValueList& arguments ) { m_argumentList += arguments; invalidateHash(); } @@ -370,7 +370,7 @@ class Macro { m_valueHash = 27 * ( HashedString::hashString( m_body ) + (m_isUndefMacro ? 1 : 0 ) ); - for( QValueList::const_iterator it = m_argumentList.begin(); it != m_argumentList.end(); ++it ) { + for( TQValueList::const_iterator it = m_argumentList.begin(); it != m_argumentList.end(); ++it ) { a *= 19; m_valueHash += a * HashedString::hashString( *it ); } @@ -383,13 +383,13 @@ class Macro { mutable size_t m_idHash; //Hash that represents the ids of all macros mutable size_t m_valueHash; //Hash that represents the values of all macros - QString m_name; - QString m_fileName; + TQString m_name; + TQString m_fileName; int m_line; int m_column; - QString m_body; + TQString m_body; bool m_hasArguments; - QStringList m_argumentList; //While identification, only the count plays a role, not the values. + TQStringList m_argumentList; //While identification, only the count plays a role, not the values. bool m_isUndefMacro; friend class NameCompare; friend class NameArgEqual; @@ -404,7 +404,7 @@ class MacroSet { void addMacro( const Macro& macro ); - void read( QDataStream& stream ) { + void read( TQDataStream& stream ) { //stream >> m_idHashValid >> m_idHash >> m_valueHashValid >> m_valueHash; m_idHashValid = false; m_valueHashValid = false; @@ -418,7 +418,7 @@ class MacroSet { } } - void write( QDataStream& stream ) const { + void write( TQDataStream& stream ) const { //stream << m_idHashValid << m_idHash << m_valueHashValid << m_valueHash; stream << int( m_usedMacros.size() ); for( Macros::const_iterator it = m_usedMacros.begin(); it != m_usedMacros.end(); ++it ) { @@ -426,9 +426,9 @@ class MacroSet { } } - bool hasMacro( const QString& name ) const; + bool hasMacro( const TQString& name ) const; bool hasMacro( const HashedString& name ) const; - Macro macro( const QString& name ) const; + Macro macro( const TQString& name ) const; size_t idHash() const; size_t valueHash() const; diff --git a/lib/cppparser/parser.cpp b/lib/cppparser/parser.cpp index bed7cbd8..31c14385 100644 --- a/lib/cppparser/parser.cpp +++ b/lib/cppparser/parser.cpp @@ -24,9 +24,9 @@ #include "errors.h" // qt -#include -#include -#include +#include +#include +#include #include #include @@ -134,7 +134,7 @@ bool Parser::reportError( const Error& err ) const Token& token = lex->lookAhead( 0 ); lex->getTokenPosition( token, &line, &col ); - QString s = lex->lookAhead(0).text(); + TQString s = lex->lookAhead(0).text(); s = s.left( 30 ).stripWhiteSpace(); if( s.isEmpty() ) s = i18n( "" ); @@ -145,7 +145,7 @@ bool Parser::reportError( const Error& err ) return true; } -bool Parser::reportError( const QString& msg ) +bool Parser::reportError( const TQString& msg ) { ////kdDebug(9007)<< "--- tok = " << lex->lookAhead(0).text() << " -- " << "Parser::reportError()" << endl; if( m_problems < m_maxProblems ){ @@ -947,7 +947,7 @@ bool Parser::parseTemplateDeclaration( DeclarationAST::Node& node ) bool Parser::parseOperator( AST::Node& /*node*/ ) { ////kdDebug(9007)<< "--- tok = " << lex->lookAhead(0).text() << " -- " << "Parser::parseOperator()" << endl; - QString text = lex->lookAhead(0).text(); + TQString text = lex->lookAhead(0).text(); switch( lex->lookAhead(0) ){ case Token_new: @@ -3297,9 +3297,9 @@ bool Parser::parseFunctionBody( StatementListAST::Node& node ) return true; } -QString Parser::toString( int start, int end, const QString& sep ) const +TQString Parser::toString( int start, int end, const TQString& sep ) const { - QStringList l; + TQStringList l; for( int i=start; itokenAt(i); diff --git a/lib/cppparser/parser.h b/lib/cppparser/parser.h index d675c3da..771df635 100644 --- a/lib/cppparser/parser.h +++ b/lib/cppparser/parser.h @@ -22,10 +22,10 @@ #include "ast.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -38,11 +38,11 @@ struct Error; class CommentFormatter { - static inline bool isWhite( QChar c ) { + static inline bool isWhite( TQChar c ) { return c.isSpace(); } - static void rStrip( QString str, QString& from ) { + static void rStrip( TQString str, TQString& from ) { if( str.isEmpty() ) return; int i = 0; @@ -66,7 +66,7 @@ class CommentFormatter { if( ip != (int)from.length() ) from = from.left( ip ); } - static void strip( QString str, QString& from ) { + static void strip( TQString str, TQString& from ) { if( str.isEmpty() ) return; int i = 0; @@ -92,8 +92,8 @@ class CommentFormatter { public: - static QString formatComment( QString comment ) { - QString ret; + static TQString formatComment( TQString comment ) { + TQString ret; int i = 0; int s = comment.length(); while( i < s && comment[i] == '/' ) { @@ -104,16 +104,16 @@ class CommentFormatter { ret = comment.mid( i ); } else { ///remove the star in each line - QStringList lines = QStringList::split( "\n", comment ); + TQStringList lines = TQStringList::split( "\n", comment ); if( lines.isEmpty() ) return ret; strip( "/**", lines.front() ); rStrip( "/**", lines.back() ); - QStringList::iterator it = lines.begin(); + TQStringList::iterator it = lines.begin(); ++it; - QStringList::iterator eit = lines.end(); + TQStringList::iterator eit = lines.end(); if( it != lines.end() ) { --eit; @@ -137,7 +137,7 @@ class CommentFormatter { }; class Comment { - QString m_text; + TQString m_text; int m_line; bool m_formatted; @@ -149,7 +149,7 @@ class Comment { } public: - Comment( QString text = "", int line = -1 ) : m_text( text ), m_line( line ), m_formatted(false) { + Comment( TQString text = "", int line = -1 ) : m_text( text ), m_line( line ), m_formatted(false) { } Comment( int line ) : m_line( line ) { @@ -165,7 +165,7 @@ class Comment { return !m_text.isEmpty(); } - operator QString() { + operator TQString() { format(); return m_text; } @@ -264,7 +264,7 @@ public: private: virtual bool reportError( const Error& err ); - /** @todo remove*/ virtual bool reportError( const QString& msg ); + /** @todo remove*/ virtual bool reportError( const TQString& msg ); /** @todo remove*/ virtual void syntaxError(); public /*rules*/ : @@ -431,7 +431,7 @@ public /*rules*/ : bool skipUntilDeclaration(); bool skipUntilStatement(); bool skip( int l, int r ); - QString toString( int start, int end, const QString& sep=" " ) const; + TQString toString( int start, int end, const TQString& sep=" " ) const; private: int currentLine(); diff --git a/lib/cppparser/tree_parser.cpp b/lib/cppparser/tree_parser.cpp index 21f451f3..508c5229 100644 --- a/lib/cppparser/tree_parser.cpp +++ b/lib/cppparser/tree_parser.cpp @@ -33,8 +33,8 @@ void TreeParser::parseTranslationUnit( const ParsedFile& translationUnit ) { ////kdDebug(9007) << "TreeParser::parseTranslationUnit()" << endl; - QPtrList declarations = translationUnit->declarationList(); - QPtrListIterator it( declarations ); + TQPtrList declarations = translationUnit->declarationList(); + TQPtrListIterator it( declarations ); while( it.current() ){ if( (it.current() == 0 ) ) { //kdDebug( 9007 ) << "declaration is zero" << endl; @@ -158,8 +158,8 @@ void TreeParser::parseFunctionDefinition( FunctionDefinitionAST* def ) void TreeParser::parseLinkageBody( LinkageBodyAST* linkageBody ) { ////kdDebug(9007) << "TreeParser::parseLinkageBody()" << endl; - QPtrList declarations = linkageBody->declarationList(); - for( QPtrListIterator it(declarations); it.current(); ++it ){ + TQPtrList declarations = linkageBody->declarationList(); + for( TQPtrListIterator it(declarations); it.current(); ++it ){ parseDeclaration( it.current() ); } } @@ -186,8 +186,8 @@ void TreeParser::parseTypeSpecifier( TypeSpecifierAST* typeSpec ) void TreeParser::parseClassSpecifier( ClassSpecifierAST* classSpec ) { ////kdDebug(9007) << "TreeParser::parseClassSpecifier()" << endl; - QPtrList declarations = classSpec->declarationList(); - for( QPtrListIterator it(declarations); it.current(); ++it ){ + TQPtrList declarations = classSpec->declarationList(); + for( TQPtrListIterator it(declarations); it.current(); ++it ){ parseDeclaration( it.current() ); } } -- cgit v1.2.1