summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/BackwardsScanner.h
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2010-06-07 13:06:21 +0200
committerErik Verbruggen <erik.verbruggen@nokia.com>2010-06-14 10:10:05 +0200
commite42ca194c53b8286447c7750feb8c7497c88e698 (patch)
treeab99d8feb411815c51f9d9a2b119aedd1a41244f /src/libs/cplusplus/BackwardsScanner.h
parent2e1001621042a5704e504821fd5677733ffd9167 (diff)
downloadqt-creator-e42ca194c53b8286447c7750feb8c7497c88e698.tar.gz
Introduced token caching to prevent repetetive tokenizing.
Also removed TokenUnderCursor as it's functionality is in the token cache. Reviewed-by: ckamm
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 cca06db75c..25b7bd3289 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 tokenIndex);
private:
+ TokenCache *_tokenCache;
QList<SimpleToken> _tokens;
int _offset;
int _blocksTokenized;
QTextBlock _block;
QString _text;
- SimpleLexer _tokenize;
int _maxBlockCount;
int _startToken;
};