diff options
author | Leandro Melo <leandro.melo@nokia.com> | 2010-12-06 19:20:37 +0100 |
---|---|---|
committer | Leandro Melo <leandro.melo@nokia.com> | 2010-12-07 10:17:26 +0100 |
commit | b5739e36cb9808dfd0688ebcb26d1b35397e660a (patch) | |
tree | c089c2eb0232c39f11b1d60eb8045f48dfbb9aee /src/plugins/texteditor/generichighlighter/progressdata.h | |
parent | 6a6d9dacc7ede5294d09b4769885ecd1d8976861 (diff) |
Gen. highlighter: Improve performance (reg. exp.)
Cache matches of the RegExprRule to avoid unnecessary calls.
This is essentially the same optimization existent in Kate.
A colateral effect of this implementation is a mechanism to
notify the rules when a progress (highlight of the current
line) is finished.
Diffstat (limited to 'src/plugins/texteditor/generichighlighter/progressdata.h')
-rw-r--r-- | src/plugins/texteditor/generichighlighter/progressdata.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/texteditor/generichighlighter/progressdata.h b/src/plugins/texteditor/generichighlighter/progressdata.h index d82b4914d5..8e104c36f5 100644 --- a/src/plugins/texteditor/generichighlighter/progressdata.h +++ b/src/plugins/texteditor/generichighlighter/progressdata.h @@ -35,10 +35,13 @@ namespace TextEditor { namespace Internal { +class Rule; + class ProgressData { public: ProgressData(); + ~ProgressData(); void setOffset(const int offset); int offset() const; @@ -66,6 +69,8 @@ public: void setCaptures(const QStringList &captures); const QStringList &captures() const; + void trackRule(Rule *rule); + private: int m_offset; int m_savedOffset; @@ -74,6 +79,7 @@ private: bool m_closingBraceMatchAtNonEnd; bool m_willContinueLine; QStringList m_captures; + QList<Rule *> m_trackedRules; }; } // namespace Internal |