aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2013-01-19 10:33:20 +1100
committernyamatongwe <devnull@localhost>2013-01-19 10:33:20 +1100
commit6db2d5521e08c79dd8ac0baccf90f1317321cf26 (patch)
tree6245a72ff2163959917088ba87590bb11ac88c12
parent7d730b5e4bd4874fde4975a271ca3c1bae63c6da (diff)
downloadscintilla-mirror-6db2d5521e08c79dd8ac0baccf90f1317321cf26.tar.gz
Add encodingType and documentVersion to decode and cache information
about the document.
-rw-r--r--lexlib/LexAccessor.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h
index c38392e88..6458525cc 100644
--- a/lexlib/LexAccessor.h
+++ b/lexlib/LexAccessor.h
@@ -25,6 +25,7 @@ private:
int startPos;
int endPos;
int codePage;
+ enum { enc8bit, encUnicode, encDBCS } encodingType;
int lenDoc;
int mask;
char styleBuf[bufferSize];
@@ -33,6 +34,7 @@ private:
char chWhile;
unsigned int startSeg;
int startPosStyling;
+ int documentVersion;
void Fill(int position) {
startPos = position - slopSize;
@@ -51,9 +53,23 @@ private:
public:
LexAccessor(IDocument *pAccess_) :
pAccess(pAccess_), startPos(extremePosition), endPos(0),
- codePage(pAccess->CodePage()), lenDoc(pAccess->Length()),
+ codePage(pAccess->CodePage()),
+ encodingType(enc8bit),
+ lenDoc(pAccess->Length()),
mask(127), validLen(0), chFlags(0), chWhile(0),
- startSeg(0), startPosStyling(0) {
+ startSeg(0), startPosStyling(0),
+ documentVersion(pAccess->Version()) {
+ switch (codePage) {
+ case 65001:
+ encodingType = encUnicode;
+ break;
+ case 932:
+ case 936:
+ case 949:
+ case 950:
+ case 1361:
+ encodingType = encDBCS;
+ }
}
char operator[](int position) {
if (position < startPos || position >= endPos) {