From f138e06ea1039b076cd525585779cf96959fca24 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 19 Jan 2013 10:33:20 +1100 Subject: Add encodingType and documentVersion to decode and cache information about the document. --- lexlib/LexAccessor.h | 20 ++++++++++++++++++-- 1 file 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) { -- cgit v1.2.3