KDevelop API Documentation

languages/cpp/backgroundparser.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2002 by Roberto Raggi * 00003 * roberto@kdevelop.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 ***************************************************************************/ 00011 00012 #ifndef BACKGROUNDPARSER_H 00013 #define BACKGROUNDPARSER_H 00014 00015 #include "driver.h" 00016 #include "ast.h" 00017 00018 #include <qthread.h> 00019 #include <qwaitcondition.h> 00020 #include <qmutex.h> 00021 #include <qmap.h> 00022 #include <kdebug.h> 00023 00024 class CppSupportPart; 00025 class TranslationUnitAST; 00026 class SynchronizedFileList; 00027 00028 class Unit 00029 { 00030 public: 00031 Unit(): translationUnit( 0 ) {} 00032 ~Unit() { delete translationUnit; translationUnit = 0; } 00033 00034 QString fileName; 00035 QValueList<Problem> problems; 00036 TranslationUnitAST* translationUnit; 00037 00038 protected: 00039 Unit( const Unit& source ); 00040 void operator = ( const Unit& source ); 00041 }; 00042 00043 class BackgroundParser: public QThread 00044 { 00045 public: 00046 BackgroundParser( CppSupportPart*, QWaitCondition* consumed ); 00047 virtual ~BackgroundParser(); 00048 00049 QMutex& mutex() { return m_mutex; } 00050 void lock() { m_mutex.lock(); } 00051 void unlock() { m_mutex.unlock(); } 00052 00053 QWaitCondition& canParse() { return m_canParse; } 00054 QWaitCondition& isEmpty() { return m_isEmpty; } 00055 00056 bool filesInQueue(); 00057 00058 void addFile( const QString& fileName, bool readFromDisk=false ); 00059 void removeFile( const QString& fileName ); 00060 void removeAllFiles(); 00061 00062 TranslationUnitAST* translationUnit( const QString& fileName ); 00063 QValueList<Problem> problems( const QString& fileName ); 00064 void updateParserConfiguration(); 00065 00066 void close(); 00067 00068 virtual void run(); 00069 00070 protected: 00071 Unit* findUnit( const QString& fileName ); 00072 Unit* parseFile( const QString& fileName, bool readFromDisk, bool lock=false ); 00073 00074 private: 00075 class KDevDriver* m_driver; 00076 QString m_currentFile; 00077 QWaitCondition m_canParse; 00078 QWaitCondition m_isEmpty; 00079 QWaitCondition* m_consumed; 00080 QMutex m_mutex; 00081 SynchronizedFileList* m_fileList; 00082 CppSupportPart* m_cppSupport; 00083 bool m_close; 00084 QMap<QString, Unit*> m_unitDict; 00085 }; 00086 00087 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:00 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003