1 // Scintilla source code edit control
2 /** @file DocumentAccessor.h
3 ** Implementation of BufferAccess and StylingAccess on a Scintilla
4 ** rapid easy access to contents of a Scintilla.
6 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
7 // The License.txt file describes the conditions under which this software may be distributed.
13 class DocumentAccessor
: public Accessor
{
14 // Private so DocumentAccessor objects can not be copied
15 DocumentAccessor(const DocumentAccessor
&source
) : Accessor(), props(source
.props
) {}
16 DocumentAccessor
&operator=(const DocumentAccessor
&) { return *this; }
24 char styleBuf
[bufferSize
];
28 unsigned int startSeg
;
31 bool InternalIsLeadByte(char ch
);
32 void Fill(int position
);
35 DocumentAccessor(Document
*pdoc_
, PropSet
&props_
, WindowID id_
=0) :
36 Accessor(), pdoc(pdoc_
), props(props_
), id(id_
),
37 lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
38 startSeg(0), startPosStyling(0) {
41 char StyleAt(int position
);
42 int GetLine(int position
);
43 int LineStart(int line
);
44 int LevelAt(int line
);
47 int GetLineState(int line
);
48 int SetLineState(int line
, int state
);
49 int GetPropertyInt(const char *key
, int defaultValue
=0) {
50 return props
.GetInt(key
, defaultValue
);
52 char *GetProperties() {
53 return props
.ToString();
55 WindowID
GetWindow() { return id
; }
57 void StartAt(unsigned int start
, char chMask
=31);
58 void SetFlags(char chFlags_
, char chWhile_
) {chFlags
= chFlags_
; chWhile
= chWhile_
; };
59 unsigned int GetStartSegment() { return startSeg
; }
60 void StartSegment(unsigned int pos
);
61 void ColourTo(unsigned int pos
, int chAttr
);
62 void SetLevel(int line
, int level
);
63 int IndentAmount(int line
, int *flags
, PFNIsCommentLeader pfnIsCommentLeader
= 0);