From 48d4a26399959121f33d2bc3bfe51c7827b654fc Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 14 Jun 2011 16:45:05 +0000 Subject: TQt4 port kdevelop This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1236710 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- languages/cpp/backgroundparser.cpp | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'languages/cpp/backgroundparser.cpp') diff --git a/languages/cpp/backgroundparser.cpp b/languages/cpp/backgroundparser.cpp index d3f9c2ee..4e22dcc7 100644 --- a/languages/cpp/backgroundparser.cpp +++ b/languages/cpp/backgroundparser.cpp @@ -53,7 +53,7 @@ private: class KDevSourceProvider: public SourceProvider { public: - //Deadlock is a mutex that is locked when KDevSourceProvider::contents(..) is used, and that should be unlocked before TQApplication is locked(that way a deadlock where the thread that holds the QApplication-mutex and tries to lock the given mutex, while the thread that calls contents(..) and holds the given mutex and tries to lock the QApplication-mutex, cannot happen) + //Deadlock is a mutex that is locked when KDevSourceProvider::contents(..) is used, and that should be unlocked before TQApplication is locked(that way a deadlock where the thread that holds the TQApplication-mutex and tries to lock the given mutex, while the thread that calls contents(..) and holds the given mutex and tries to lock the TQApplication-mutex, cannot happen) KDevSourceProvider( CppSupportPart* cppSupport, TQMutex& deadlock ) : m_cppSupport( cppSupport ), m_readFromDisk( false ), @@ -71,7 +71,7 @@ public: virtual TQString contents( const TQString& fileName ) { - TQString contents = TQString::null; + TQString contents = TQString(); if ( !m_readFromDisk ) { @@ -105,7 +105,7 @@ public: //kdDebug(9007) << "-------> kapp unlocked" << endl; } - if( m_readFromDisk || contents == TQString::null ) + if( m_readFromDisk || contents == TQString() ) { TQFile f( fileName ); if ( f.open( IO_ReadOnly ) ) @@ -149,7 +149,7 @@ typedef std::string SafeString; class SynchronizedFileList { - typedef std::list< QPair > ListType; + typedef std::list< TQPair > ListType; public: SynchronizedFileList() {} @@ -166,7 +166,7 @@ public: return m_fileList.size(); } - QPair front() const + TQPair front() const { TQMutexLocker locker( &m_mutex ); return m_fileList.front(); @@ -182,14 +182,14 @@ public: { SafeString s( fileName.ascii() ); TQMutexLocker locker( &m_mutex ); - m_fileList.push_front( qMakePair( s, readFromDisk ) ); + m_fileList.push_front( tqMakePair( s, readFromDisk ) ); } void push_back( const TQString& fileName, bool readFromDisk = false ) { SafeString s( fileName.ascii() ); TQMutexLocker locker( &m_mutex ); - m_fileList.push_back( qMakePair( s, readFromDisk ) ); + m_fileList.push_back( tqMakePair( s, readFromDisk ) ); } void pop_front() @@ -212,15 +212,15 @@ public: return c; } - QPair takeFront() + TQPair takeFront() { TQMutexLocker locker( &m_mutex ); - QPair ret = m_fileList.front(); + TQPair ret = m_fileList.front(); m_fileList.pop_front(); return ret; } - bool contains( const TQString& fileName ) const + bool tqcontains( const TQString& fileName ) const { TQMutexLocker locker( &m_mutex ); ListType::const_iterator it = m_fileList.begin(); @@ -283,7 +283,7 @@ void BackgroundParser::addFile( const TQString& fileName, bool readFromDisk ) TQString fn = deepCopy( fileName ); //bool added = false; - /*if ( !m_fileList->contains( fn ) ) + /*if ( !m_fileList->tqcontains( fn ) ) { m_fileList->push_back( fn, readFromDisk ); added = true; @@ -299,7 +299,7 @@ void BackgroundParser::addFileFront( const TQString& fileName, bool readFromDisk TQString fn = deepCopy( fileName ); bool added = false; - /*if ( m_fileList->contains( fn ) ) + /*if ( m_fileList->tqcontains( fn ) ) m_fileList->remove( fn );*/ m_fileList->push_front( fn, readFromDisk ); @@ -387,15 +387,15 @@ void BackgroundParser::fileParsed( ParsedFile& file ) { ParsedFilePointer translationUnitUnsafe = m_driver->takeTranslationUnit( file.fileName() ); //now file and translationUnitUnsafe are the same ParsedFilePointer translationUnit; - //Since the lexer-cache keeps many QStrings like macro-names used in the background, everything must be copied here. The safest solution is just + //Since the lexer-cache keeps many TQStrings like macro-names used in the background, everything must be copied here. The safest solution is just //serializing and deserializing the whole thing(the serialization does not respect the AST, but that can be copied later because that's safe) TQMemArray data; { - TQDataStream stream( data, IO_WriteOnly ); + TQDataStream stream( TQByteArray(data), IO_WriteOnly ); translationUnitUnsafe->write( stream ); } { - TQDataStream stream( data, IO_ReadOnly ); + TQDataStream stream( TQByteArray(data), IO_ReadOnly ); translationUnit = new ParsedFile( stream ); } @@ -410,7 +410,7 @@ void BackgroundParser::fileParsed( ParsedFile& file ) { static_cast( m_driver->sourceProvider() ) ->setReadFromDisk( false ); - if ( m_unitDict.find( file.fileName() ) != m_unitDict.end() ) + if ( m_unitDict.tqfind( file.fileName() ) != m_unitDict.end() ) { Unit * u = m_unitDict[ file.fileName() ]; m_unitDict.remove( file.fileName() ); @@ -422,7 +422,7 @@ void BackgroundParser::fileParsed( ParsedFile& file ) { KApplication::postEvent( m_cppSupport, new FileParsedEvent( file.fileName(), unit->problems, m_readFromDisk ) ); - m_currentFile = TQString::null; + m_currentFile = TQString(); if ( m_fileList->isEmpty() ) m_isEmpty.wakeAll(); @@ -430,12 +430,12 @@ void BackgroundParser::fileParsed( ParsedFile& file ) { Unit* BackgroundParser::findUnit( const TQString& fileName ) { - TQMap::Iterator it = m_unitDict.find( fileName ); + TQMap::Iterator it = m_unitDict.tqfind( fileName ); return it != m_unitDict.end() ? *it : 0; } bool BackgroundParser::hasTranslationUnit( const TQString& fileName ) { - TQMap::Iterator it = m_unitDict.find( fileName ); + TQMap::Iterator it = m_unitDict.tqfind( fileName ); return it != m_unitDict.end(); } @@ -526,7 +526,7 @@ void BackgroundParser::run() if ( m_close ) break; - QPair entry = m_fileList->takeFront(); + TQPair entry = m_fileList->takeFront(); TQString fileName = entry.first.c_str(); bool readFromDisk = entry.second; m_currentFile = deepCopy(fileName); @@ -534,7 +534,7 @@ void BackgroundParser::run() ( void ) parseFile( fileName, readFromDisk, true ); - m_currentFile = TQString::null; + m_currentFile = TQString(); } kdDebug( 9007 ) << "!!!!!!!!!!!!!!!!!! BG PARSER DESTROYED !!!!!!!!!!!!" << endl; -- cgit v1.2.1