diff options
| author | Neil <nyamatongwe@gmail.com> | 2015-07-29 09:46:53 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2015-07-29 09:46:53 +1000 | 
| commit | 7604a6b2a98fc2250408368eb51f8f6827d888c8 (patch) | |
| tree | 12d1805299de9c35a8c3e17a92480212125f50c0 /lexlib/LexAccessor.h | |
| parent | e9f77f985ad02f0bc79580e3df572c6c6449d03e (diff) | |
| download | scintilla-mirror-7604a6b2a98fc2250408368eb51f8f6827d888c8.tar.gz | |
Change lexlib to use Sci_Position and Sci_PositionU to prepare for large file
support.
Diffstat (limited to 'lexlib/LexAccessor.h')
| -rw-r--r-- | lexlib/LexAccessor.h | 54 | 
1 files changed, 27 insertions, 27 deletions
| diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h index 8e3455d0c..f2cce50bd 100644 --- a/lexlib/LexAccessor.h +++ b/lexlib/LexAccessor.h @@ -24,18 +24,18 @@ private:  	 * in case there is some backtracking. */  	enum {bufferSize=4000, slopSize=bufferSize/8};  	char buf[bufferSize+1]; -	int startPos; -	int endPos; +	Sci_Position startPos; +	Sci_Position endPos;  	int codePage;  	enum EncodingType encodingType; -	int lenDoc; +	Sci_Position lenDoc;  	char styleBuf[bufferSize]; -	int validLen; -	unsigned int startSeg; -	int startPosStyling; +	Sci_Position validLen; +	Sci_PositionU startSeg; +	Sci_Position startPosStyling;  	int documentVersion; -	void Fill(int position) { +	void Fill(Sci_Position position) {  		startPos = position - slopSize;  		if (startPos + bufferSize > lenDoc)  			startPos = lenDoc - bufferSize; @@ -73,7 +73,7 @@ public:  			encodingType = encDBCS;  		}  	} -	char operator[](int position) { +	char operator[](Sci_Position position) {  		if (position < startPos || position >= endPos) {  			Fill(position);  		} @@ -86,7 +86,7 @@ public:  		return 0;  	}  	/** Safe version of operator[], returning a defined value for invalid position. */ -	char SafeGetCharAt(int position, char chDefault=' ') { +	char SafeGetCharAt(Sci_Position position, char chDefault=' ') {  		if (position < startPos || position >= endPos) {  			Fill(position);  			if (position < startPos || position >= endPos) { @@ -102,7 +102,7 @@ public:  	EncodingType Encoding() const {  		return encodingType;  	} -	bool Match(int pos, const char *s) { +	bool Match(Sci_Position pos, const char *s) {  		for (int i=0; *s; i++) {  			if (*s != SafeGetCharAt(pos+i))  				return false; @@ -110,21 +110,21 @@ public:  		}  		return true;  	} -	char StyleAt(int position) const { +	char StyleAt(Sci_Position position) const {  		return static_cast<char>(pAccess->StyleAt(position));  	} -	int GetLine(int position) const { +	Sci_Position GetLine(Sci_Position position) const {  		return pAccess->LineFromPosition(position);  	} -	int LineStart(int line) const { +	Sci_Position LineStart(Sci_Position line) const {  		return pAccess->LineStart(line);  	} -	int LineEnd(int line) { +	Sci_Position LineEnd(Sci_Position line) {  		if (documentVersion >= dvLineEnd) {  			return (static_cast<IDocumentWithLineEnd *>(pAccess))->LineEnd(line);  		} else {  			// Old interface means only '\r', '\n' and '\r\n' line ends. -			int startNext = pAccess->LineStart(line+1); +			Sci_Position startNext = pAccess->LineStart(line+1);  			char chLineEnd = SafeGetCharAt(startNext-1);  			if (chLineEnd == '\n' && (SafeGetCharAt(startNext-2)  == '\r'))  				return startNext - 2; @@ -132,10 +132,10 @@ public:  				return startNext - 1;  		}  	} -	int LevelAt(int line) const { +	int LevelAt(Sci_Position line) const {  		return pAccess->GetLevel(line);  	} -	int Length() const { +	Sci_Position Length() const {  		return lenDoc;  	}  	void Flush() { @@ -145,24 +145,24 @@ public:  			validLen = 0;  		}  	} -	int GetLineState(int line) const { +	int GetLineState(Sci_Position line) const {  		return pAccess->GetLineState(line);  	} -	int SetLineState(int line, int state) { +	int SetLineState(Sci_Position line, int state) {  		return pAccess->SetLineState(line, state);  	}  	// Style setting -	void StartAt(unsigned int start) { +	void StartAt(Sci_PositionU start) {  		pAccess->StartStyling(start, '\377');  		startPosStyling = start;  	} -	unsigned int GetStartSegment() const { +	Sci_PositionU GetStartSegment() const {  		return startSeg;  	} -	void StartSegment(unsigned int pos) { +	void StartSegment(Sci_PositionU pos) {  		startSeg = pos;  	} -	void ColourTo(unsigned int pos, int chAttr) { +	void ColourTo(Sci_PositionU pos, int chAttr) {  		// Only perform styling if non empty range  		if (pos != startSeg - 1) {  			assert(pos >= startSeg); @@ -176,7 +176,7 @@ public:  				// Too big for buffer so send directly  				pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));  			} else { -				for (unsigned int i = startSeg; i <= pos; i++) { +				for (Sci_PositionU i = startSeg; i <= pos; i++) {  					assert((startPosStyling + validLen) < Length());  					styleBuf[validLen++] = static_cast<char>(chAttr);  				} @@ -184,15 +184,15 @@ public:  		}  		startSeg = pos+1;  	} -	void SetLevel(int line, int level) { +	void SetLevel(Sci_Position line, int level) {  		pAccess->SetLevel(line, level);  	} -	void IndicatorFill(int start, int end, int indicator, int value) { +	void IndicatorFill(Sci_Position start, Sci_Position end, int indicator, int value) {  		pAccess->DecorationSetCurrentIndicator(indicator);  		pAccess->DecorationFillRange(start, value, end - start);  	} -	void ChangeLexerState(int start, int end) { +	void ChangeLexerState(Sci_Position start, Sci_Position end) {  		pAccess->ChangeLexerState(start, end);  	}  }; | 
