KDevelop API Documentation

languages/cpp/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 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00016 #ifndef _CPPSUPPORTPART_H_ 00017 #define _CPPSUPPORTPART_H_ 00018 00019 #include <kdevcore.h> 00020 #include <kdevlanguagesupport.h> 00021 00022 #include <kdialogbase.h> 00023 #include <qguardedptr.h> 00024 #include <qstring.h> 00025 #include <qwaitcondition.h> 00026 #include <qdatetime.h> 00027 00028 class Context; 00029 class CppCodeCompletion; 00030 class CppCodeCompletionConfig; 00031 class ProblemReporter; 00032 class BackgroundParser; 00033 class Catalog; 00034 class QLabel; 00035 class QProgressBar; 00036 class QStringList; 00037 class QListViewItem; 00038 class QTimer; 00039 class KListView; 00040 class Driver; 00041 00042 namespace KParts { class Part; } 00043 namespace KTextEditor 00044 { 00045 class Document; 00046 class View; 00047 class EditInterface; 00048 class SelectionInterface; 00049 class ViewCursorInterface; 00050 } 00051 00052 class CppSupportPart : public KDevLanguageSupport 00053 { 00054 Q_OBJECT 00055 00056 public: 00057 CppSupportPart( QObject *parent, const char *name, const QStringList &args ); 00058 virtual ~CppSupportPart(); 00059 00060 bool isValid() const { return m_valid; } 00061 00062 QString specialHeaderName( bool local=false ) const; 00063 void updateParserConfiguration(); 00064 00065 ProblemReporter* problemReporter() { return isValid() ? (ProblemReporter*)m_problemReporter : 0; } 00066 BackgroundParser* backgroundParser() { return m_backgroundParser; } 00067 CppCodeCompletion* codeCompletion() { return m_pCompletion; } 00068 CppCodeCompletionConfig* codeCompletionConfig() { return m_pCompletionConfig; } 00069 00070 const QPtrList<Catalog>& catalogList() { return m_catalogList; } 00071 void addCatalog( Catalog* catalog ); 00072 void removeCatalog( const QString& dbName ); 00073 00074 bool isValidSource( const QString& fileName ) const; 00075 00076 virtual void customEvent( QCustomEvent* ev ); 00077 00078 virtual QStringList subclassWidget(const QString& formName); 00079 virtual QStringList updateWidget(const QString& formName, const QString& fileName); 00080 00081 FunctionDefinitionDom currentFunctionDefinition(); 00082 FunctionDefinitionDom functionDefinitionAt( int line, int column ); 00083 FunctionDefinitionDom functionDefinitionAt( NamespaceDom ns, int line, int column ); 00084 FunctionDefinitionDom functionDefinitionAt( ClassDom klass, int line, int column ); 00085 FunctionDefinitionDom functionDefinitionAt( FunctionDefinitionDom fun, int line, int column ); 00086 00087 KTextEditor::Document* findDocument( const KURL& url ); 00088 00089 static KConfig *config(); 00090 00091 virtual QString formatTag( const Tag& tag ); 00092 virtual QString formatModelItem( const CodeModelItem *item, bool shortDescription=false ); 00093 virtual void addClass(); 00094 00095 QString extractInterface( const ClassDom& klass ); 00096 00097 bool isHeader(const QString& fileName) const; 00098 bool isSource(const QString& fileName) const; 00099 00100 signals: 00101 void fileParsed( const QString& fileName ); 00102 00103 protected: 00104 virtual KDevLanguageSupport::Features features(); 00105 virtual KMimeType::List mimeTypes(); 00106 virtual QString formatClassName(const QString &name); 00107 virtual QString unformatClassName(const QString &name); 00108 virtual void addMethod( ClassDom klass ); 00109 virtual void addAttribute( ClassDom klass ); 00110 00111 private slots: 00112 void activePartChanged(KParts::Part *part); 00113 void partRemoved( KParts::Part* part ); 00114 void projectOpened(); 00115 void projectClosed(); 00116 void savedFile(const QString &fileName); 00117 void configWidget(KDialogBase *dlg); 00118 void projectConfigWidget(KDialogBase *dlg); 00119 void contextMenu(QPopupMenu *popup, const Context *context); 00120 void addedFilesToProject(const QStringList &fileList); 00121 void removedFilesFromProject(const QStringList &fileList); 00122 void changedFilesInProject( const QStringList & fileList ); 00123 void slotProjectCompiled(); 00124 void setupCatalog(); 00125 void codeCompletionConfigStored(); 00126 void recomputeCodeModel( const QString& fileName ); 00127 void slotNewClass(); 00128 void slotSwitchHeader(); 00129 void slotGotoIncludeFile(); 00130 void slotCompleteText(); 00131 void slotMakeMember(); 00132 void slotExtractInterface(); 00133 void slotCursorPositionChanged(); 00134 void slotFunctionHint(); 00135 void gotoLine( int line ); 00136 void gotoDeclarationLine( int line ); 00137 void emitFileParsed(); 00138 00139 void slotNeedTextHint( int, int, QString& ); 00140 00144 void initialParse( ); 00145 00149 bool parseProject( bool force=false ); 00150 00151 private: 00152 00156 void maybeParse( const QString& fileName ); 00157 void removeWithReferences( const QString& fileName ); 00158 void createIgnorePCSFile(); 00159 00160 QString sourceOrHeaderCandidate(); 00161 00162 QStringList modifiedFileList(); 00163 QString findSourceFile(); 00164 int pcsVersion(); 00165 void setPcsVersion( int version ); 00166 00167 void saveProjectSourceInfo(); 00168 static QStringList reorder(const QStringList& list ); 00169 static QString findHeader( const QStringList&list, const QString& header ); 00170 00171 CppCodeCompletion* m_pCompletion; 00172 CppCodeCompletionConfig* m_pCompletionConfig; 00173 00174 bool withcpp; 00175 QString m_contextFileName; 00176 00177 QGuardedPtr< ProblemReporter > m_problemReporter; 00178 BackgroundParser* m_backgroundParser; 00179 00180 KTextEditor::Document* m_activeDocument; 00181 KTextEditor::View* m_activeView; 00182 KTextEditor::SelectionInterface* m_activeSelection; 00183 KTextEditor::EditInterface* m_activeEditor; 00184 KTextEditor::ViewCursorInterface* m_activeViewCursor; 00185 QString m_activeFileName; 00186 00187 QWaitCondition m_eventConsumed; 00188 bool m_projectClosed; 00189 00190 QMap<QString, QDateTime> m_timestamp; 00191 bool m_valid; 00192 00193 QPtrList<Catalog> m_catalogList; 00194 Driver* m_driver; 00195 QString m_projectDirectory; 00196 QStringList m_projectFileList; 00197 00198 ClassDom m_activeClass; 00199 FunctionDom m_activeFunction; 00200 VariableDom m_activeVariable; 00201 00202 QTimer* m_functionHintTimer; 00203 00204 static QStringList m_sourceMimeTypes; 00205 static QStringList m_headerMimeTypes; 00206 00207 static QStringList m_sourceExtensions; 00208 static QStringList m_headerExtensions; 00209 00210 friend class KDevCppSupportIface; 00211 friend class CppDriver; 00212 }; 00213 00214 #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 Tue Oct 19 08:01:42 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003