1
// Scintilla source code edit control
3
** Rapid easy access to contents of a Scintilla.
5
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6
// The License.txt file describes the conditions under which this software may be distributed.
8
enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
12
typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
15
* Interface to data in a Scintilla.
19
enum {extremePosition=0x7FFFFFFF};
20
/** @a bufferSize is a trade off between time taken to copy the characters
21
* and retrieval overhead.
22
* @a slopSize positions the buffer before the desired position
23
* in case there is some backtracking. */
24
enum {bufferSize=4000, slopSize=bufferSize/8};
25
char buf[bufferSize+1];
30
virtual bool InternalIsLeadByte(char ch)=0;
31
virtual void Fill(int position)=0;
34
Accessor() : startPos(extremePosition), endPos(0), codePage(0) {}
35
virtual ~Accessor() {}
36
char operator[](int position) {
37
if (position < startPos || position >= endPos) {
40
return buf[position - startPos];
42
/** Safe version of operator[], returning a defined value for invalid position. */
43
char SafeGetCharAt(int position, char chDefault=' ') {
44
if (position < startPos || position >= endPos) {
46
if (position < startPos || position >= endPos) {
47
// Position is outside range of document
51
return buf[position - startPos];
53
bool IsLeadByte(char ch) {
54
return codePage && InternalIsLeadByte(ch);
56
void SetCodePage(int codePage_) { codePage = codePage_; }
58
virtual bool Match(int pos, const char *s)=0;
59
virtual char StyleAt(int position)=0;
60
virtual int GetLine(int position)=0;
61
virtual int LineStart(int line)=0;
62
virtual int LevelAt(int line)=0;
63
virtual int Length()=0;
64
virtual void Flush()=0;
65
virtual int GetLineState(int line)=0;
66
virtual int SetLineState(int line, int state)=0;
67
virtual int GetPropertyInt(const char *key, int defaultValue=0)=0;
68
virtual char *GetProperties()=0;
71
virtual void StartAt(unsigned int start, char chMask=31)=0;
72
virtual void SetFlags(char chFlags_, char chWhile_)=0;
73
virtual unsigned int GetStartSegment()=0;
74
virtual void StartSegment(unsigned int pos)=0;
75
virtual void ColourTo(unsigned int pos, int chAttr)=0;
76
virtual void SetLevel(int line, int level)=0;
77
virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0;