aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/BackwardsScanner.h
diff options
context:
space:
mode:
authorErik Verbruggen <[email protected]>2010-06-04 09:36:05 +0200
committerErik Verbruggen <[email protected]>2010-06-04 09:36:05 +0200
commitc2393df02332618c8cf6159d9d6f6a40041ced89 (patch)
tree4230c145cc5fa6576310afebe989003151ed38d1 /src/libs/cplusplus/BackwardsScanner.h
parent414d9fe3e0fe03f27432b9943e7b2bb5bc2f716c (diff)
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/libs/cplusplus/BackwardsScanner.h')
-rw-r--r--src/libs/cplusplus/BackwardsScanner.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libs/cplusplus/BackwardsScanner.h b/src/libs/cplusplus/BackwardsScanner.h
index 64be2bc508f..585ed705b51 100644
--- a/src/libs/cplusplus/BackwardsScanner.h
+++ b/src/libs/cplusplus/BackwardsScanner.h
@@ -36,16 +36,18 @@
namespace CPlusPlus {
+class TokenCache;
+
class CPLUSPLUS_EXPORT BackwardsScanner
{
enum { MAX_BLOCK_COUNT = 10 };
public:
- BackwardsScanner(const QTextCursor &cursor,
- const QString &suffix = QString(),
- int maxBlockCount = MAX_BLOCK_COUNT);
+ BackwardsScanner(TokenCache *cache,
+ const QTextCursor &cursor,
+ int maxBlockCount = MAX_BLOCK_COUNT,
+ const QString &suffix = QString());
- int state() const;
int startToken() const;
int startPosition() const;
@@ -67,20 +69,18 @@ public:
int startOfMatchingBrace(int index) const;
int startOfBlock(int index) const;
- static int previousBlockState(const QTextBlock &block);
-
int size() const;
private:
const SimpleToken &fetchToken(int i);
private:
+ TokenCache *_tokenCache;
QList<SimpleToken> _tokens;
int _offset;
int _blocksTokenized;
QTextBlock _block;
QString _text;
- SimpleLexer _tokenize;
int _maxBlockCount;
int _startToken;
};