kdevplatform/language/duchain
#include <duchain.h>

Public Slots | |
void | emitDeclarationSelected (const KDevelop::DeclarationPointer &decl) |
void | emitUpdateReady (const KDevelop::IndexedString &url, const KDevelop::ReferencedTopDUContext &topContext) |
void | removeDocumentChain (KDevelop::TopDUContext *document) |
void | shutdown () |
Signals | |
void | declarationSelected (const KDevelop::DeclarationPointer &decl) |
void | updateReady (const KDevelop::IndexedString &url, const KDevelop::ReferencedTopDUContext &topContext) |
Public Member Functions | |
void | addDocumentChain (TopDUContext *chain) |
QList< TopDUContext * > | allChains () const |
QList< ParsingEnvironmentFilePointer > | allEnvironmentFiles (const IndexedString &document) |
TopDUContext * | chainForDocument (const IndexedString &document, bool proxyContext=false) const |
TopDUContext * | chainForDocument (const IndexedString &document, const ParsingEnvironment *environment, bool proxyContext=false) const |
TopDUContext * | chainForDocument (const QUrl &document, bool proxyContext=false) const |
TopDUContext * | chainForDocument (const QUrl &document, const ParsingEnvironment *environment, bool proxyContext=false) const |
TopDUContext * | chainForIndex (uint index) |
QList< TopDUContext * > | chainsForDocument (const IndexedString &document) const |
QList< TopDUContext * > | chainsForDocument (const QUrl &document) const |
bool | compareToDisk () |
void | disablePersistentStorage (bool disable=true) |
QList< QUrl > | documents () const |
ParsingEnvironmentFilePointer | environmentFileForDocument (const IndexedString &document, const ParsingEnvironment *environment, bool proxyContext=false) const |
ParsingEnvironmentFilePointer | environmentFileForDocument (IndexedTopDUContext topContext) const |
QList< IndexedString > | indexedDocuments () const |
bool | isInMemory (uint topContextIndex) const |
void | storeToDisk () |
void | updateContextEnvironment (TopDUContext *context, ParsingEnvironmentFile *file) |
void | updateContextForUrl (const IndexedString &document, TopDUContext::Features minFeatures, QObject *notifyReady=nullptr, int priority=1) const |
IndexedString | urlForIndex (uint index) const |
KDevelop::ReferencedTopDUContext | waitForUpdate (const KDevelop::IndexedString &document, KDevelop::TopDUContext::Features minFeatures, bool proxyContext=false) |
![]() | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Static Public Member Functions | |
static Definitions * | definitions () |
static bool | deleted () |
static void | initialize () |
static DUChainLock * | lock () |
static uint | newTopContextIndex () |
static QString | repositoryPathForSession (const KDevelop::ISessionLock::Ptr &session) |
static DUChain * | self () |
static Uses * | uses () |
![]() | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Additional Inherited Members | |
![]() | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
![]() | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
![]() | |
objectName | |
Detailed Description
Holds references to all top level source file contexts.
The DUChain is a global static class which manages the definition-use chains. It performs the following functions:
- registers chains with addDocumentChain() and deregisters with removeDocumentChain()
- allows querying for existing chains
- watches text editors, registering and deregistering them with the BackgroundParser when files are opened and closed.
Member Function Documentation
◆ addDocumentChain()
void KDevelop::DUChain::addDocumentChain | ( | TopDUContext * | chain | ) |
Registers a new definition-use chain for the given document.
Definition at line 1320 of file duchain.cpp.
◆ allChains()
QList< TopDUContext * > KDevelop::DUChain::allChains | ( | ) | const |
Return a list of all chains available.
Definition at line 1288 of file duchain.cpp.
◆ allEnvironmentFiles()
QList< ParsingEnvironmentFilePointer > KDevelop::DUChain::allEnvironmentFiles | ( | const IndexedString & | document | ) |
Returns the list of the environment-infos of all versions of the given document.
Definition at line 1515 of file duchain.cpp.
◆ chainForDocument() [1/4]
TopDUContext* KDevelop::DUChain::chainForDocument | ( | const IndexedString & | document, |
bool | proxyContext = false |
||
) | const |
◆ chainForDocument() [2/4]
TopDUContext * KDevelop::DUChain::chainForDocument | ( | const IndexedString & | document, |
const ParsingEnvironment * | environment, | ||
bool | proxyContext = false |
||
) | const |
Find a chain that fits into the given environment.
If no fitting chain is found, 0 is returned. When no fitting chain is in memory, one may be loaded from disk.
- Parameters
-
proxyContext If this is true, only contexts are found that have an ParsingEnvironmentFile that has the proxy-flag set. Else, only content-contexts will be returned.
Prefer this over the QUrl version.
- Note
- The duchain must be at least read-locked locked when this is called!
Definition at line 1528 of file duchain.cpp.
◆ chainForDocument() [3/4]
TopDUContext * KDevelop::DUChain::chainForDocument | ( | const QUrl & | document, |
bool | proxyContext = false |
||
) | const |
Return any chain for the given document If available, the version accepting IndexedString should be used instead of this, for performance reasons.
When no fitting chain is in memory, one may be loaded from disk.
- Note
- The duchain must be at least read-locked locked when this is called!
Definition at line 1389 of file duchain.cpp.
◆ chainForDocument() [4/4]
TopDUContext * KDevelop::DUChain::chainForDocument | ( | const QUrl & | document, |
const ParsingEnvironment * | environment, | ||
bool | proxyContext = false |
||
) | const |
Find a chain that fits into the given environment.
If no fitting chain is found, 0 is returned. When no fitting chain is in memory, one may be loaded from disk.
- Parameters
-
proxyContext If this is true, only contexts are found that have an ParsingEnvironmentFile that has the proxy-flag set. Else, only content-contexts will be returned.
- Note
- The duchain must be at least read-locked locked when this is called!
Definition at line 1485 of file duchain.cpp.
◆ chainForIndex()
|
inline |
Returns the top-context that has the given index assigned, or zero if it doesn't exist.
- See also
- TopDUContext::ownIndex The duchain must be read-locked when this is called This function is inlined because it is called in a very high frequency
◆ chainsForDocument() [1/2]
QList< TopDUContext * > KDevelop::DUChain::chainsForDocument | ( | const IndexedString & | document | ) | const |
Return all chains for the given document that are currently in memory.
This does not load any chains from disk. Should be preferred over the QUrl version.
Definition at line 1464 of file duchain.cpp.
◆ chainsForDocument() [2/2]
QList< TopDUContext * > KDevelop::DUChain::chainsForDocument | ( | const QUrl & | document | ) | const |
Return all chains for the given document that are currently in memory.
This does not load any chains from disk.
Definition at line 1459 of file duchain.cpp.
◆ compareToDisk()
bool KDevelop::DUChain::compareToDisk | ( | ) |
Compares the whole duchain and all its repositories in the current state to disk When the comparison fails, debug-output will show why The duchain must not be locked when calling this.
- Returns
- true If the current memory state equals the disk state, else false
Step 1: Compare the repositories
Definition at line 1874 of file duchain.cpp.
◆ declarationSelected
|
signal |
Is emitted when the declaration has been selected somewhere in the user-interface, for example in the completion-list.
◆ definitions()
|
static |
Returns the structure that manages mapping between definitions and declarations.
Definition at line 1694 of file duchain.cpp.
◆ deleted()
|
static |
Returns true if the global duchain instance has already been deleted.
Definition at line 1776 of file duchain.cpp.
◆ disablePersistentStorage()
void KDevelop::DUChain::disablePersistentStorage | ( | bool | disable = true | ) |
If you call this, the persistent disk-storage structure will stay unaffected, and no duchain cleanup will be done.
Call this from within tests.
Definition at line 1859 of file duchain.cpp.
◆ documents()
Only used for debugging at the moment.
Definition at line 1541 of file duchain.cpp.
◆ emitDeclarationSelected
|
slot |
Emits the declarationSelected signal, so other parties can notice it.
Definition at line 1796 of file duchain.cpp.
◆ emitUpdateReady
|
slot |
Call this after you have modified the DUChain data associated with the file url
.
This triggers an emit of the updateReady
signal.
Definition at line 1804 of file duchain.cpp.
◆ environmentFileForDocument() [1/2]
ParsingEnvironmentFilePointer KDevelop::DUChain::environmentFileForDocument | ( | const IndexedString & | document, |
const ParsingEnvironment * | environment, | ||
bool | proxyContext = false |
||
) | const |
Find the environment-file of a chain that fits into the given environment.
If no fitting chain is found, 0 is returned. When no fitting chain is in memory, one may be loaded from disk.
This should be preferred over chainForDocument when only the environment-info is needed, because the TopDUContext is not loaded in this function.
- Parameters
-
proxyContext If this is true, only contexts are found that have an ParsingEnvironmentFile that has the proxy-flag set. Else, only content-contexts will be returned.
Prefer this over the QUrl version.
- Note
- The duchain must be at least read-locked locked when this is called!
Definition at line 1491 of file duchain.cpp.
◆ environmentFileForDocument() [2/2]
ParsingEnvironmentFilePointer KDevelop::DUChain::environmentFileForDocument | ( | IndexedTopDUContext | topContext | ) | const |
Definition at line 1520 of file duchain.cpp.
◆ indexedDocuments()
QList< IndexedString > KDevelop::DUChain::indexedDocuments | ( | ) | const |
Only used for debugging at the moment Prefer that over the QUrl version for performance reasons.
Definition at line 1554 of file duchain.cpp.
◆ initialize()
|
static |
Initializes common static item repositories.
Must be called once for multi threaded applications to work reliably.
Definition at line 1250 of file duchain.cpp.
◆ isInMemory()
bool KDevelop::DUChain::isInMemory | ( | uint | topContextIndex | ) | const |
Returns whether the top-context with the given index is currently loaded in memory.
Definition at line 1394 of file duchain.cpp.
◆ lock()
|
static |
Retrieve the read write lock for the entire definition-use chain.
To call non-const methods, you must be holding a write lock.
Evaluations made prior to holding a lock (including which objects exist) must be verified once the lock is held, as they may have changed or been deleted.
Definition at line 1283 of file duchain.cpp.
◆ newTopContextIndex()
|
static |
Allocates a new identity for a new top-context, no lock needed. The returned value is never zero.
Definition at line 1750 of file duchain.cpp.
◆ removeDocumentChain
|
slot |
Removes the given top-context from the duchain, and deletes it.
This assertion fails if you call removeDocumentChain(..) on a document that has not been added to the du-chain
Definition at line 1305 of file duchain.cpp.
◆ repositoryPathForSession()
|
static |
Definition at line 1241 of file duchain.cpp.
◆ self()
|
static |
Returns the global static instance.
Definition at line 1230 of file duchain.cpp.
◆ shutdown
|
slot |
Shutdown and cleanup the DUChain.
Definition at line 1715 of file duchain.cpp.
◆ storeToDisk()
void KDevelop::DUChain::storeToDisk | ( | ) |
Stores the whole duchain and all its repositories in the current state to disk The duchain must not be locked in any way.
Definition at line 1864 of file duchain.cpp.
◆ updateContextEnvironment()
void KDevelop::DUChain::updateContextEnvironment | ( | TopDUContext * | context, |
ParsingEnvironmentFile * | file | ||
) |
Changes the environment attached to the given top-level context, and updates the management-structures to reflect that.
Definition at line 1294 of file duchain.cpp.
◆ updateContextForUrl()
void KDevelop::DUChain::updateContextForUrl | ( | const IndexedString & | document, |
TopDUContext::Features | minFeatures, | ||
QObject * | notifyReady = nullptr , |
||
int | priority = 1 |
||
) | const |
Makes sure the standard-context for the given url is up-to-date.
This may trigger a parsing in background, so a QObject can be given that will be notified asynchronously once the update is ready. If the context is already up to date, the given QObject is notified directly.
- Parameters
-
document Document to update minFeatures The requested features. If you want to force a full update of the context, give TopDUContext::ForceUpdate. If you want to force an update including all imports, use TopDUContext::ForceUpdateRecursive. notifyReady An optional pointer to a QObject that should contain a slot "void updateReady(KDevelop::IndexedString url, KDevelop::ReferencedTopDUContext topContext)". The notification is guaranteed to be called once for each call to updateContextForUrl. The given top-context may be invalid if the update failed. A queued connection is used if a re-parse has to be done. The duchain will not be locked when updateReady is called. priority An optional priority for the job. The lower the value, the higher it's priority.
- Note
- The duchain must not be locked when this is called!
Start a parse-job for the given document
Definition at line 1839 of file duchain.cpp.
◆ updateReady
|
signal |
◆ urlForIndex()
IndexedString KDevelop::DUChain::urlForIndex | ( | uint | index | ) | const |
Returns the url for the given top-context index if available. This does have some cost, so avoid it when possible.
Definition at line 1399 of file duchain.cpp.
◆ uses()
|
static |
Returns the structure that manages mapping between declarations, and which top level contexts contain uses of them.
Definition at line 1689 of file duchain.cpp.
◆ waitForUpdate()
KDevelop::ReferencedTopDUContext KDevelop::DUChain::waitForUpdate | ( | const KDevelop::IndexedString & | document, |
KDevelop::TopDUContext::Features | minFeatures, | ||
bool | proxyContext = false |
||
) |
Convenience-function similar to updateContextForUrl that blocks this thread until the update of the given document is ready, and returns the top-context.
- Parameters
-
document The document to update minFeatures The requested features. If you want to force a full update of the context, give TopDUContext::ForceUpdate. If you want to force an update including all imports, use TopDUContext::ForceUpdateRecursive.
- Returns
- The up-to-date top-context, or zero if the update failed
- Note
- The duchain must not be locked when this is called!
Definition at line 1812 of file duchain.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 09:40:52 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.