• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/language/backgroundparser

  • KDevelop
  • BackgroundParser
Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | List of all members
KDevelop::BackgroundParser Class Reference

#include <backgroundparser.h>

Inheritance diagram for KDevelop::BackgroundParser:
Inheritance graph
[legend]

Public Types

enum  { BestPriority = -10000, NormalPriority = 0, InitialParsePriority = 10000, WorstPriority = 100000 }
 

Public Slots

void abortAllJobs ()
 
void addDocument (const IndexedString &url, TopDUContext::Features features=TopDUContext::VisibleDeclarationsAndContexts, int priority=0, QObject *notifyWhenReady=nullptr, ParseJob::SequentialProcessingFlags flags=ParseJob::IgnoresSequentialProcessing, int delay_ms=ILanguageSupport::DefaultDelay)
 
void disableProcessing ()
 
void documentClosed (KDevelop::IDocument *)
 
void documentLoaded (KDevelop::IDocument *)
 
void documentUrlChanged (KDevelop::IDocument *)
 
void enableProcessing ()
 
bool isIdle () const
 
bool isQueued (const IndexedString &url) const
 
void loadSettings ()
 
void parseDocuments ()
 
int priorityForDocument (const IndexedString &url) const
 
int queuedCount () const
 
void removeDocument (const IndexedString &url, QObject *notifyWhenReady=nullptr)
 
void resume ()
 
void revertAllRequests (QObject *notifyWhenReady)
 
void setNeededPriority (int priority)
 
void suspend ()
 
void updateProgressData ()
 

Signals

void clearMessage (KDevelop::IStatus *) override
 
void hideProgress (KDevelop::IStatus *) override
 
void parseJobFinished (KDevelop::ParseJob *job)
 
void showErrorMessage (const QString &, int) override
 
void showMessage (KDevelop::IStatus *, const QString &message, int timeout=0) override
 
void showProgress (KDevelop::IStatus *, int minimum, int maximum, int value) override
 

Public Member Functions

 BackgroundParser (ILanguageController *languageController)
 
 ~BackgroundParser () override
 
QList< IndexedString > managedDocuments ()
 
ParseJob * parseJobForDocument (const IndexedString &document) const
 
void setDelay (int milliseconds)
 
void setThreadCount (int threadCount)
 
QString statusName () const override
 
int threadCount () const
 
DocumentChangeTracker * trackerForUrl (const IndexedString &url) const
 
bool waitForIdle () const
 
- Public Member Functions inherited from QObject
 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 &regExp) 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
 

Protected Slots

void aboutToQuit ()
 
void parseComplete (const ThreadWeaver::JobPointer &job)
 
void parseProgress (KDevelop::ParseJob *, float value, const QString &text)
 
void startTimer (int delay)
 
void updateProgressBar ()
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
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)
 
- Protected Member Functions inherited from QObject
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)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

This class handles the creation of parse jobs for given file URLs.

For performance reasons you must always use clean, canonical URLs. If you do not do that, issues might arise (and the debug build will assert).

Definition at line 53 of file backgroundparser.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
BestPriority 
NormalPriority 

Best possible job-priority. No jobs should actually have this.

InitialParsePriority 

Standard job-priority.

This priority is used for parse-jobs caused by document-editing/opening. There is an additional parsing-thread reserved for jobs with this and better priority, to improve responsiveness.

WorstPriority 

Priority used when adding file on project loading.

Definition at line 66 of file backgroundparser.h.

Constructor & Destructor Documentation

◆ BackgroundParser()

BackgroundParser::BackgroundParser ( ILanguageController *  languageController)
explicit

Definition at line 513 of file backgroundparser.cpp.

◆ ~BackgroundParser()

BackgroundParser::~BackgroundParser ( )
override

Definition at line 547 of file backgroundparser.cpp.

Member Function Documentation

◆ abortAllJobs

void BackgroundParser::abortAllJobs ( )
slot

Aborts all parse jobs.

Definition at line 759 of file backgroundparser.cpp.

◆ aboutToQuit

void BackgroundParser::aboutToQuit ( )
protectedslot

Definition at line 540 of file backgroundparser.cpp.

◆ addDocument

void BackgroundParser::addDocument ( const IndexedString &  url,
TopDUContext::Features  features = TopDUContext::VisibleDeclarationsAndContexts,
int  priority = 0,
QObject *  notifyWhenReady = nullptr,
ParseJob::SequentialProcessingFlags  flags = ParseJob::IgnoresSequentialProcessing,
int  delay_ms = ILanguageSupport::DefaultDelay 
)
slot

Queues up the url to be parsed.

features The minimum features that should be computed for this top-context priority A value that manages the order of parsing. Documents with lowest priority are parsed first.

Parameters
notifyWhenReadyAn 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 addDocument. The given top-context may be invalid if the update failed.
flagsFlags indicating how the document should be treated in the queue
delay_msThe delay in milliseconds to add the job with, or one of the values of the ILanguageSupport::ReparseDelaySpecialValues enum.

Definition at line 601 of file backgroundparser.cpp.

◆ clearMessage

void KDevelop::BackgroundParser::clearMessage ( KDevelop::IStatus *  )
overridesignal

◆ disableProcessing

void BackgroundParser::disableProcessing ( )
slot

Disables all processing of new jobs, equivalent to setNeededPriority(BestPriority)

Definition at line 706 of file backgroundparser.cpp.

◆ documentClosed

void BackgroundParser::documentClosed ( KDevelop::IDocument *  )
slot

Definition at line 911 of file backgroundparser.cpp.

◆ documentLoaded

void BackgroundParser::documentLoaded ( KDevelop::IDocument *  )
slot

Definition at line 939 of file backgroundparser.cpp.

◆ documentUrlChanged

void BackgroundParser::documentUrlChanged ( KDevelop::IDocument *  )
slot

Definition at line 969 of file backgroundparser.cpp.

◆ enableProcessing

void BackgroundParser::enableProcessing ( )
slot

Enables all processing of new jobs, equivalent to setNeededPriority(WorstPriority)

Definition at line 711 of file backgroundparser.cpp.

◆ hideProgress

void KDevelop::BackgroundParser::hideProgress ( KDevelop::IStatus *  )
overridesignal

◆ isIdle

bool BackgroundParser::isIdle ( ) const
slot

Returns true if there are no jobs running nor queued anywhere.

Definition at line 742 of file backgroundparser.cpp.

◆ isQueued

bool BackgroundParser::isQueued ( const IndexedString &  url) const
slot

Returns true if the given url is queued for parsing.

Definition at line 725 of file backgroundparser.cpp.

◆ loadSettings

void BackgroundParser::loadSettings ( )
slot

Definition at line 557 of file backgroundparser.cpp.

◆ managedDocuments()

QList< IndexedString > BackgroundParser::managedDocuments ( )

Returns all documents that were added through addManagedTopRange.

This is typically the currently open documents.

Definition at line 858 of file backgroundparser.cpp.

◆ parseComplete

void BackgroundParser::parseComplete ( const ThreadWeaver::JobPointer &  job)
protectedslot

Definition at line 681 of file backgroundparser.cpp.

◆ parseDocuments

void BackgroundParser::parseDocuments ( )
slot

Forces the current queue to be parsed.

Definition at line 668 of file backgroundparser.cpp.

◆ parseJobFinished

void KDevelop::BackgroundParser::parseJobFinished ( KDevelop::ParseJob *  job)
signal

Emitted whenever a document parse-job has finished.

The job contains the du-chain(if one was created) etc.

The job is deleted after this signal has been emitted. Receivers should not hold references to it.

Note that if you want to be get updated for all DUChain updates, use DUChain::updateReady instead, as a single ParseJob may update multiple DUChain top contexts.

See also
DUChain::updateReady

◆ parseJobForDocument()

ParseJob * BackgroundParser::parseJobForDocument ( const IndexedString &  document) const

Queries the background parser as to whether there is currently a parse job for document, and if so, returns it.

This may not contain all of the parse jobs that are intended unless you call in from your job's ThreadWeaver::Job::aboutToBeQueued() function.

Definition at line 820 of file backgroundparser.cpp.

◆ parseProgress

void BackgroundParser::parseProgress ( KDevelop::ParseJob *  job,
float  value,
const QString &  text 
)
protectedslot

Definition at line 564 of file backgroundparser.cpp.

◆ priorityForDocument

int BackgroundParser::priorityForDocument ( const IndexedString &  url) const
slot

Retrieve the current priority for the given URL.

You need to check whether

Parameters
urlis queued before calling this function.

Definition at line 716 of file backgroundparser.cpp.

◆ queuedCount

int BackgroundParser::queuedCount ( ) const
slot

Returns the number of queued jobs (not yet running nor submitted to ThreadWeaver)

Definition at line 734 of file backgroundparser.cpp.

◆ removeDocument

void BackgroundParser::removeDocument ( const IndexedString &  url,
QObject *  notifyWhenReady = nullptr 
)
slot

Removes the url that is registered for the given notification from the url.

Parameters
notifyWhenReadyNotifier the document was added with.

Definition at line 638 of file backgroundparser.cpp.

◆ resume

void BackgroundParser::resume ( )
slot

Resumes execution of the background parser.

NOTE: Only the Core should call this

Definition at line 777 of file backgroundparser.cpp.

◆ revertAllRequests

void BackgroundParser::revertAllRequests ( QObject *  notifyWhenReady)
slot

Reverts all requests that were made for the given notification-target.

priorities and requested features will be reverted as well. When notifyWhenReady is set to a nullptr, all requests will be reverted.

Definition at line 574 of file backgroundparser.cpp.

◆ setDelay()

void BackgroundParser::setDelay ( int  milliseconds)

Set the delay in milliseconds before the background parser starts parsing.

Definition at line 848 of file backgroundparser.cpp.

◆ setNeededPriority

void BackgroundParser::setNeededPriority ( int  priority)
slot

Disables processing for all jobs that have a worse priority than priority This can be used to temporarily limit the processing to only the most important jobs.

To only enable processing for important jobs, call setNeededPriority(0). This should only be used to temporarily alter the processing. A progress-bar will still be shown for the not yet processed jobs.

Definition at line 750 of file backgroundparser.cpp.

◆ setThreadCount()

void BackgroundParser::setThreadCount ( int  threadCount)

Set how many ThreadWeaver threads the background parser should set up and use.

Definition at line 831 of file backgroundparser.cpp.

◆ showErrorMessage

void KDevelop::BackgroundParser::showErrorMessage ( const QString &  ,
int   
)
overridesignal

◆ showMessage

void KDevelop::BackgroundParser::showMessage ( KDevelop::IStatus *  ,
const QString &  message,
int  timeout = 0 
)
overridesignal

◆ showProgress

void KDevelop::BackgroundParser::showProgress ( KDevelop::IStatus *  ,
int  minimum,
int  maximum,
int  value 
)
overridesignal

◆ startTimer

void BackgroundParser::startTimer ( int  delay)
protectedslot

Definition at line 978 of file backgroundparser.cpp.

◆ statusName()

QString BackgroundParser::statusName ( ) const
override

Definition at line 552 of file backgroundparser.cpp.

◆ suspend

void BackgroundParser::suspend ( )
slot

Suspends execution of the background parser.

NOTE: Only the Core should call this

Definition at line 768 of file backgroundparser.cpp.

◆ threadCount()

int BackgroundParser::threadCount ( ) const

Return how many ThreadWeaver threads the background parser should set up and use.

Definition at line 841 of file backgroundparser.cpp.

◆ trackerForUrl()

DocumentChangeTracker * BackgroundParser::trackerForUrl ( const IndexedString &  url) const

Returns the tracker for the given url if the document is being tracked, else returns zero.

This function is thread-safe, but the returned object also isn't, so you must not use it when you're in a background thread without the foreground lock acquired.

Definition at line 893 of file backgroundparser.cpp.

◆ updateProgressBar

void BackgroundParser::updateProgressBar ( )
protectedslot

Definition at line 1008 of file backgroundparser.cpp.

◆ updateProgressData

void BackgroundParser::updateProgressData ( )
slot

Definition at line 785 of file backgroundparser.cpp.

◆ waitForIdle()

bool BackgroundParser::waitForIdle ( ) const

Definition at line 866 of file backgroundparser.cpp.


The documentation for this class was generated from the following files:
  • backgroundparser.h
  • backgroundparser.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Mar 8 2021 23:29:35 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/language/backgroundparser

Skip menu "kdevplatform/language/backgroundparser"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal