KDevelop API Documentation

cppsupportpart.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 1999 by Jonas Nordin                                    *
00003  *   jonas.nordin@syncom.se                                                *
00004  *   Copyright (C) 2000-2001 by Bernd Gehrmann                             *
00005  *   bernd@kdevelop.org                                                    *
00006  *   Copyright (C) 2002-2003 by Roberto Raggi                              *
00007  *   roberto@kdevelop.org                                                  *
00008  *   Copyright (C) 2003-2004 by Alexander Dymo                             *
00009  *   adymo@mksat.net                                                       *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef _CPPSUPPORTPART_H_
00019 #define _CPPSUPPORTPART_H_
00020 
00021 #include <kdevcore.h>
00022 #include <kdevlanguagesupport.h>
00023 
00024 #include <kdialogbase.h>
00025 #include <qguardedptr.h>
00026 #include <qstring.h>
00027 #include <qwaitcondition.h>
00028 #include <qdatetime.h>
00029 #include <qdir.h>
00030 #include <qprogressbar.h>
00031 
00032 class Context;
00033 class CppCodeCompletion;
00034 class CppCodeCompletionConfig;
00035 class ProblemReporter;
00036 class BackgroundParser;
00037 class Catalog;
00038 class QLabel;
00039 class QProgressBar;
00040 class QStringList;
00041 class QListViewItem;
00042 class QTimer;
00043 class KListView;
00044 class Driver;
00045 
00046 namespace KParts { class Part; }
00047 namespace KTextEditor
00048 {
00049     class Document;
00050     class View;
00051     class EditInterface;
00052     class SelectionInterface;
00053     class ViewCursorInterface;
00054 }
00055 
00056 class CppSupportPart : public KDevLanguageSupport
00057 {
00058     Q_OBJECT
00059 
00060 public:
00061     CppSupportPart( QObject *parent, const char *name, const QStringList &args );
00062     virtual ~CppSupportPart();
00063 
00064     bool isValid() const { return m_valid; }
00065     
00066     QString specialHeaderName( bool local=false ) const;
00067     void updateParserConfiguration();
00068 
00069     // @fixme - isValid is used to avoid using the problem reporter
00070     // when a project is first parsed. This because the problem reporter
00071     // is currently a great slowdown for large projects (see bug #73671)
00072     ProblemReporter* problemReporter() { return isValid() ? static_cast<ProblemReporter *>(m_problemReporter) : 0; }
00073     
00074     BackgroundParser* backgroundParser() { return m_backgroundParser; }
00075     CppCodeCompletion* codeCompletion() { return m_pCompletion; }
00076     CppCodeCompletionConfig* codeCompletionConfig() { return m_pCompletionConfig; }
00077 
00078     const QPtrList<Catalog>& catalogList() { return m_catalogList; }
00079     void addCatalog( Catalog* catalog );
00080     void removeCatalog( const QString& dbName );
00081 
00082     bool isValidSource( const QString& fileName ) const;
00083 
00084     virtual void customEvent( QCustomEvent* ev );
00085 
00086     virtual QStringList subclassWidget(const QString& formName);
00087     virtual QStringList updateWidget(const QString& formName, const QString& fileName);
00088     
00089     FunctionDefinitionDom currentFunctionDefinition();
00090     FunctionDefinitionDom functionDefinitionAt( int line, int column );
00091     FunctionDefinitionDom functionDefinitionAt( NamespaceDom ns, int line, int column );
00092     FunctionDefinitionDom functionDefinitionAt( ClassDom klass, int line, int column );
00093     FunctionDefinitionDom functionDefinitionAt( FunctionDefinitionDom fun, int line, int column );
00094 
00095     KTextEditor::Document* findDocument( const KURL& url );
00096 
00097     static KConfig *config();
00098 
00099     virtual QString formatTag( const Tag& tag );
00100     virtual QString formatModelItem( const CodeModelItem *item, bool shortDescription=false );
00101     virtual void addClass();
00102 
00103     QString extractInterface( const ClassDom& klass );
00104 
00105     bool isHeader(const QString& fileName) const;
00106     bool isSource(const QString& fileName) const;
00107 
00108     virtual KDevDesignerIntegration *designer(KInterfaceDesigner::DesignerType type);
00109     
00110 signals:
00111     void fileParsed( const QString& fileName );
00112 
00113 protected:
00114     virtual KDevLanguageSupport::Features features();
00115     virtual KMimeType::List mimeTypes();
00116     virtual QString formatClassName(const QString &name);
00117     virtual QString unformatClassName(const QString &name);
00118     virtual void addMethod( ClassDom klass );
00119     virtual void addAttribute( ClassDom klass );
00120 
00121 private slots:
00122     void activePartChanged(KParts::Part *part);
00123     void partRemoved( KParts::Part* part );
00124     void projectOpened();
00125     void projectClosed();
00126     void savedFile(const KURL &fileName);
00127     void configWidget(KDialogBase *dlg);
00128     void projectConfigWidget(KDialogBase *dlg);
00129     void contextMenu(QPopupMenu *popup, const Context *context);
00130     void addedFilesToProject(const QStringList &fileList);
00131     void removedFilesFromProject(const QStringList &fileList);
00132     void changedFilesInProject( const QStringList & fileList );
00133     void slotProjectCompiled();
00134     void setupCatalog();
00135     void codeCompletionConfigStored();
00136     void recomputeCodeModel( const QString& fileName );
00137     void slotNewClass();
00138     void slotSwitchHeader();
00139     void slotGotoIncludeFile();
00140     void slotCompleteText();
00141     void slotMakeMember();
00142     void slotExtractInterface();
00143     void slotCursorPositionChanged();
00144     void slotFunctionHint();
00145     void gotoLine( int line );
00146     void gotoDeclarationLine( int line );
00147     void emitFileParsed();
00148     void slotParseFiles();
00149     void slotCreateSubclass();
00150 
00151     void slotNeedTextHint( int, int, QString& );
00152 
00156     void initialParse( );
00157 
00161     bool parseProject( bool force=false );
00162 
00163 private:
00164 
00168     void maybeParse( const QString& fileName );
00169     void removeWithReferences( const QString& fileName );
00170     void createIgnorePCSFile();
00171 
00172     void MakeMemberHelper(QString& text, int& atline, int& atcol);
00173 
00174     QString sourceOrHeaderCandidate();
00175 
00176     QStringList modifiedFileList();
00177     QString findSourceFile();
00178     int pcsVersion();
00179     void setPcsVersion( int version );
00180 
00181     void saveProjectSourceInfo();
00182     static QStringList reorder(const QStringList& list );
00183     static QString findHeader( const QStringList&list, const QString& header );
00184 
00185     CppCodeCompletion* m_pCompletion;
00186     CppCodeCompletionConfig* m_pCompletionConfig;
00187 
00188     bool withcpp;
00189     QString m_contextFileName;
00190 
00191     QGuardedPtr< ProblemReporter > m_problemReporter;
00192     BackgroundParser* m_backgroundParser;
00193 
00194     KTextEditor::Document* m_activeDocument;
00195     KTextEditor::View* m_activeView;
00196     KTextEditor::SelectionInterface* m_activeSelection;
00197     KTextEditor::EditInterface* m_activeEditor;
00198     KTextEditor::ViewCursorInterface* m_activeViewCursor;
00199     QString m_activeFileName;
00200     
00201     QMap<KInterfaceDesigner::DesignerType, KDevDesignerIntegration*> m_designers;
00202 
00203     QWaitCondition m_eventConsumed;
00204     bool m_projectClosed;
00205 
00206     QMap<QString, QDateTime> m_timestamp;
00207     bool m_valid;
00208 
00209     QPtrList<Catalog> m_catalogList;
00210     Driver* m_driver;
00211     QString m_projectDirectory;
00212     QStringList m_projectFileList;
00213 
00214     ClassDom m_activeClass;
00215     FunctionDom m_activeFunction;
00216     VariableDom m_activeVariable;
00217     
00218     QTimer* m_functionHintTimer;
00219     
00220     static QStringList m_sourceMimeTypes;
00221     static QStringList m_headerMimeTypes;
00222 
00223     static QStringList m_sourceExtensions;
00224     static QStringList m_headerExtensions;
00225     
00226     friend class KDevCppSupportIface;
00227     friend class CppDriver;
00228 
00229     struct JobData
00230     {
00231         QDir dir;
00232         QProgressBar * progressBar;
00233         QStringList::Iterator it;
00234         QStringList files;
00235         QMap< QString, QPair<uint, uint> > pcs;
00236         QDataStream stream;
00237         QFile file;
00238         
00239         ~JobData()
00240         {
00241             delete progressBar;
00242         }
00243     };
00244     
00245     JobData * _jd;
00246 };
00247 
00248 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:46 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003