1 // Scintilla source code edit control
\r
2 /** @file DocumentAccessor.h
\r
3 ** Implementation of BufferAccess and StylingAccess on a Scintilla
\r
4 ** rapid easy access to contents of a Scintilla.
\r
6 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
\r
7 // The License.txt file describes the conditions under which this software may be distributed.
\r
10 namespace Scintilla {
\r
17 class DocumentAccessor : public Accessor {
\r
18 // Private so DocumentAccessor objects can not be copied
\r
19 DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {}
\r
20 DocumentAccessor &operator=(const DocumentAccessor &) { return *this; }
\r
28 char styleBuf[bufferSize];
\r
32 unsigned int startSeg;
\r
33 int startPosStyling;
\r
36 bool InternalIsLeadByte(char ch);
\r
37 void Fill(int position);
\r
40 DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
\r
41 Accessor(), pdoc(pdoc_), props(props_), id(id_),
\r
42 lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
\r
43 startSeg(0), startPosStyling(0),
\r
44 mask(127) { // Initialize the mask to be big enough for any lexer.
\r
46 ~DocumentAccessor();
\r
47 bool Match(int pos, const char *s);
\r
48 char StyleAt(int position);
\r
49 int GetLine(int position);
\r
50 int LineStart(int line);
\r
51 int LevelAt(int line);
\r
54 int GetLineState(int line);
\r
55 int SetLineState(int line, int state);
\r
56 int GetPropertyInt(const char *key, int defaultValue=0) {
\r
57 return props.GetInt(key, defaultValue);
\r
59 char *GetProperties() {
\r
60 return props.ToString();
\r
62 WindowID GetWindow() { return id; }
\r
64 void StartAt(unsigned int start, char chMask=31);
\r
65 void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
\r
66 unsigned int GetStartSegment() { return startSeg; }
\r
67 void StartSegment(unsigned int pos);
\r
68 void ColourTo(unsigned int pos, int chAttr);
\r
69 void SetLevel(int line, int level);
\r
70 int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
\r
71 void IndicatorFill(int start, int end, int indicator, int value);
\r
74 #ifdef SCI_NAMESPACE
\r