language/duchain
duchain.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DUCHAIN_H
00021 #define DUCHAIN_H
00022
00023 #include <QtCore/QObject>
00024
00025 #include "duchainobserver.h"
00026 #include "topducontext.h"
00027
00028 class KUrl;
00029
00030 namespace KDevelop
00031 {
00032
00033 class IDocument;
00034 class TopDUContext;
00035 class DUChainLock;
00036
00037 class IdentifiedFile;
00038 class ParsingEnvironmentManager;
00039 class ParsingEnvironment;
00040 class ParsingEnvironmentFile;
00041 typedef KSharedPtr<ParsingEnvironmentFile> ParsingEnvironmentFilePointer;
00042 class Definitions;
00043 class Uses;
00044
00055 class KDEVPLATFORMLANGUAGE_EXPORT DUChain : public QObject
00056 {
00057 Q_OBJECT
00058
00059 public:
00063 Q_SCRIPTABLE QList<TopDUContext*> allChains() const;
00064
00079 Q_SCRIPTABLE void updateContextForUrl(const IndexedString& document, TopDUContext::Features minFeatures, QObject* notifyReady = 0) const;
00080
00091 KDevelop::ReferencedTopDUContext waitForUpdate(const IndexedString& document, TopDUContext::Features minFeatures, bool wantProxyContext = false);
00092
00098 Q_SCRIPTABLE TopDUContext* chainForDocument(const KUrl& document) const;
00099 Q_SCRIPTABLE TopDUContext* chainForDocument(const IndexedString& document) const;
00100
00105 Q_SCRIPTABLE QList<TopDUContext*> chainsForDocument(const KUrl& document) const;
00106
00112 Q_SCRIPTABLE QList<TopDUContext*> chainsForDocument(const IndexedString& document) const;
00113
00119 Q_SCRIPTABLE TopDUContext* chainForDocument(const KUrl& document, const ParsingEnvironment* environment, bool onlyProxyContexts = false, bool noProxyContexts = false) const;
00120
00128 Q_SCRIPTABLE TopDUContext* chainForDocument(const IndexedString& document, const ParsingEnvironment* environment, bool onlyProxyContexts = false, bool noProxyContexts = false) const;
00129
00140 Q_SCRIPTABLE ParsingEnvironmentFilePointer environmentFileForDocument(const IndexedString& document, const ParsingEnvironment* environment, bool onlyProxyContexts = false, bool noProxyContexts = false) const;
00141
00142 Q_SCRIPTABLE ParsingEnvironmentFilePointer environmentFileForDocument(IndexedTopDUContext topContext) const;
00143
00147 Q_SCRIPTABLE QList<ParsingEnvironmentFilePointer> allEnvironmentFiles(const IndexedString& document);
00148
00151 Q_SCRIPTABLE TopDUContext* chainForIndex(uint index) const;
00152
00154 Q_SCRIPTABLE IndexedString urlForIndex(uint index) const;
00155
00157 Q_SCRIPTABLE QList<KUrl> documents() const;
00158
00162 Q_SCRIPTABLE void addDocumentChain(TopDUContext* chain);
00163
00165 Q_SCRIPTABLE static bool deleted();
00166
00168 Q_SCRIPTABLE static DUChain* self();
00169
00171 Q_SCRIPTABLE static Definitions* definitions();
00172
00174 static Uses* uses();
00175
00186 Q_SCRIPTABLE static DUChainLock* lock();
00187
00189 Q_SCRIPTABLE static DUChainObserver* notifier();
00190
00191
00192
00193
00194
00195
00196
00198 Q_SCRIPTABLE static void branchAdded(DUContext* context);
00200 Q_SCRIPTABLE static void branchModified(DUContext* context);
00202 Q_SCRIPTABLE static void branchRemoved(DUContext* context);
00203
00205 Q_SCRIPTABLE bool isInMemory(uint topContextIndex) const;
00206
00210 Q_SCRIPTABLE void updateContextEnvironment( TopDUContext* context, ParsingEnvironmentFile* file );
00211
00213 static uint newTopContextIndex();
00214
00217 void disablePersistentStorage();
00218
00221 void storeToDisk();
00222
00227 bool compareToDisk();
00228
00235 void finalCleanup();
00236
00237 Q_SIGNALS:
00239 void declarationSelected(DeclarationPointer decl);
00240 public Q_SLOTS:
00242 void removeDocumentChain(TopDUContext* document);
00244 void emitDeclarationSelected(DeclarationPointer decl);
00245
00246 private Q_SLOTS:
00247 void documentActivated(KDevelop::IDocument* doc);
00248 void documentAboutToBeDeleted(KTextEditor::Document* doc);
00249 void documentAboutToBeDeletedFinal(KTextEditor::Document* doc);
00250 void documentLoadedPrepare(KDevelop::IDocument* document);
00251 void documentRenamed(KDevelop::IDocument* document);
00252 void aboutToQuit();
00253 private:
00257 void refCountUp(TopDUContext* top);
00258
00261 void refCountDown(TopDUContext* top);
00262
00263 void addToEnvironmentManager( TopDUContext * chain );
00264 void removeFromEnvironmentManager( TopDUContext * chain );
00265 DUChain();
00266 ~DUChain();
00267
00268 friend class DUChainPrivate;
00269 friend class ReferencedTopDUContext;
00270 };
00271
00272 }
00273
00274 #endif // DUCHAIN_H
00275
00276