1 // DocumentAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
2 // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
3 // The License.txt file describes the conditions under which this software may be distributed.
7 class DocumentAccessor
: public Accessor
{
8 // Private so DocumentAccessor objects can not be copied
9 DocumentAccessor(const DocumentAccessor
&source
) : Accessor(), props(source
.props
) {}
10 DocumentAccessor
&operator=(const DocumentAccessor
&) { return *this; }
16 char styleBuf
[bufferSize
];
20 unsigned int startSeg
;
22 bool InternalIsLeadByte(char ch
);
23 void Fill(int position
);
25 DocumentAccessor(Document
*pdoc_
, PropSet
&props_
) :
26 Accessor(), pdoc(pdoc_
), props(props_
),
27 lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
30 char StyleAt(int position
);
31 int GetLine(int position
);
32 int LineStart(int line
);
33 int LevelAt(int line
);
36 int GetLineState(int line
);
37 int SetLineState(int line
, int state
);
38 int GetPropertyInt(const char *key
, int defaultValue
=0) {
39 return props
.GetInt(key
, defaultValue
);
42 void StartAt(unsigned int start
, char chMask
=31);
43 void SetFlags(char chFlags_
, char chWhile_
) {chFlags
= chFlags_
; chWhile
= chWhile_
; };
44 unsigned int GetStartSegment() { return startSeg
; }
45 void StartSegment(unsigned int pos
);
46 void ColourTo(unsigned int pos
, int chAttr
);
47 void SetLevel(int line
, int level
);
48 int IndentAmount(int line
, int *flags
, PFNIsCommentLeader pfnIsCommentLeader
= 0);