aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2013-01-19 10:33:20 +1100
committernyamatongwe <unknown>2013-01-19 10:33:20 +1100
commitf138e06ea1039b076cd525585779cf96959fca24 (patch)
tree4d8778ab715d86e9988b5387ee225e3dfb7e609d
parent178778065469f1b51fde436e213b12d04343ac80 (diff)
downloadscintilla-mirror-f138e06ea1039b076cd525585779cf96959fca24.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) {