summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolseditorsupport.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2010-06-04 09:36:05 +0200
committerErik Verbruggen <erik.verbruggen@nokia.com>2010-06-04 09:36:05 +0200
commitc2393df02332618c8cf6159d9d6f6a40041ced89 (patch)
tree4230c145cc5fa6576310afebe989003151ed38d1 /src/plugins/cpptools/cpptoolseditorsupport.cpp
parent414d9fe3e0fe03f27432b9943e7b2bb5bc2f716c (diff)
downloadqt-creator-c2393df02332618c8cf6159d9d6f6a40041ced89.tar.gz
Introduced a token cache for the C++ editor.
This should speed things up a bit, because before, the line was tokenized at least 3 times.
Diffstat (limited to 'src/plugins/cpptools/cpptoolseditorsupport.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index 77cccf1018..33eed4e020 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -67,8 +67,12 @@ void CppEditorSupport::setTextEditor(TextEditor::ITextEditor *textEditor)
{
_textEditor = textEditor;
- if (! _textEditor)
+ if (_textEditor) {
+ if (TextEditor::BaseTextEditor *ed = qobject_cast<TextEditor::BaseTextEditor *>(_textEditor->widget()))
+ _tokenCache.setDocument(ed->document());
+ } else {
return;
+ }
connect(_textEditor, SIGNAL(contentsChanged()), this, SIGNAL(contentsChanged()));
connect(this, SIGNAL(contentsChanged()), this, SLOT(updateDocument()));
@@ -96,6 +100,11 @@ unsigned CppEditorSupport::editorRevision() const
return 0;
}
+TokenCache *CppEditorSupport::tokenCache()
+{
+ return &_tokenCache;
+}
+
int CppEditorSupport::updateDocumentInterval() const
{ return _updateDocumentInterval; }