51
ParseJob( const KUrl &url );
53
explicit ParseJob( const IndexedString &url, ILanguageSupport* languageSupport );
53
55
* _No_ mutexes/locks are allowed to be locked when this object is destroyed (except for optionally the foreground lock)
55
57
virtual ~ParseJob();
60
* @return the language support that created this parse job.
62
ILanguageSupport* languageSupport() const;
58
65
// Modification-time of the read content
59
66
ModificationRevision modification;
81
88
* _No_ mutexes/locks are allowed to be locked when this is called (except for optionally the foreground lock)
83
90
* Locks the document revision so that mapping from/to the revision in the editor using MovingInterface will be possible.
85
92
* Returns an invalid pointer if the call succeeds, and a valid one if the reading fails.
87
94
KDevelop::ProblemPointer readContents();
90
97
* After reading the contents, you can call this to retrieve it.
92
99
const Contents& contents() const;
95
102
* Translates the given context from its previous revision to the revision that has
96
103
* been retrieved during readContents(). The top-context meta-data will be updated
97
104
* with the revision.
99
106
* This can be done after reading the context before updating, so
100
107
* that the correct ranges are matched onto each other during the update.
102
109
* _No_ mutexes/locks are allowed to be locked when this is called (except for optionally the foreground lock)
104
111
void translateDUChainToRevision(TopDUContext* context);
107
114
* Query whether this job is needed to be waited for when trying to process a job with a lower priority.
124
131
* The notification is guaranteed to be called once the parse-job finishes, from within its destructor.
125
132
* The given top-context may be invalid if the update failed.
127
Q_SCRIPTABLE void setNotifyWhenReady(QList<QWeakPointer<QObject> > notify);
134
Q_SCRIPTABLE void setNotifyWhenReady(const QList<QWeakPointer<QObject> >& notify);
129
136
/// Sets the du-context that was created by this parse-job
130
137
Q_SCRIPTABLE virtual void setDuChain(ReferencedTopDUContext duChain);
131
138
/// Returns the set du-context, or zero of none was set.
144
151
/// Set the minimum features the resulting top-context should have
145
152
Q_SCRIPTABLE void setMinimumFeatures(TopDUContext::Features features);
147
154
/// Minimum set of features the resulting top-context should have
148
155
Q_SCRIPTABLE TopDUContext::Features minimumFeatures() const;
150
157
/// Allows statically specifying an amount of features required for an url.
151
158
/// These features will automatically be or'ed with the minimumFeatures() returned
152
159
/// by any ParseJob with the given url.
153
160
/// Since this causes some additional complixity in update-checking, minimum features should not
154
161
/// be set permanently.
155
static void setStaticMinimumFeatures(IndexedString url, TopDUContext::Features features);
162
static void setStaticMinimumFeatures(const IndexedString& url, TopDUContext::Features features);
157
164
/// Must be called exactly once for each call to setStaticMinimumFeatures, with the same features.
158
static void unsetStaticMinimumFeatures(IndexedString url, TopDUContext::Features features);
165
static void unsetStaticMinimumFeatures(const IndexedString& url, TopDUContext::Features features);
160
167
/// Returns the statically set minimum features for the given url, or zero.
161
static TopDUContext::Features staticMinimumFeatures(IndexedString url);
168
static TopDUContext::Features staticMinimumFeatures(const IndexedString& url);
163
170
/// Returns whether there is minimum features set up for some url
164
171
static bool hasStaticMinimumFeatures();
173
///Returns a structure containing information about data accesses in the parsed file.
174
/// It's up to the caller to remove the returned instance
175
virtual KDevelop::DataAccessRepository* dataAccessInformation();
177
///Returns a control flow graph for the code in the parsed file.
178
/// It's up to the caller to remove the returned instance
179
virtual KDevelop::ControlFlowGraph* controlFlowGraph();
167
182
/**Can be used to give progress feedback to the background-parser. @param value should be between 0 and 1, where 0 = 0% and 1 = 100%
168
183
* @param text may be a text that describes the current state of parsing
169
184
* Do not trigger this too often, for performance reasons. */
170
void progress(KDevelop::ParseJob*, float value, QString text);
185
void progress(KDevelop::ParseJob*, float value, const QString& text);
189
* Checks whether there is already an up to date context available for the
190
* current document. If so, it returns true and ensures that the document
191
* is highlighted properly. Otherwise returns false.
193
* NOTE: This should be called while holding an URLParseLock for the
196
* @param languageString The unique string identifying your language.
197
* This must be the same as you assign to the DUChain's environment file.
199
* @return True if an update is required, false if the job can return early.
201
bool isUpdateRequired(const IndexedString& languageString);
204
* Trigger an update to the code highlighting of the current file based
205
* on the DUChain set in setDuChain.
207
* If the file for this parse job is not opened in an editor or if the language
208
* support does not return a code highlighter, this will do nothing.
210
* NOTE: No DUChain lock should be held when you call this.
212
void highlightDUChain();
173
215
class ParseJobPrivate* const d;