]>
Commit | Line | Data |
---|---|---|
f6bcfd97 BP |
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. | |
4 | ||
5 | class Document; | |
6 | ||
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; } | |
11 | protected: | |
12 | Document *pdoc; | |
13 | PropSet &props; | |
14 | int lenDoc; | |
15 | ||
16 | char styleBuf[bufferSize]; | |
17 | int validLen; | |
18 | char chFlags; | |
19 | char chWhile; | |
20 | unsigned int startSeg; | |
21 | ||
22 | bool InternalIsLeadByte(char ch); | |
23 | void Fill(int position); | |
24 | public: | |
25 | DocumentAccessor(Document *pdoc_, PropSet &props_) : | |
26 | Accessor(), pdoc(pdoc_), props(props_), | |
d134f170 | 27 | lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { |
f6bcfd97 BP |
28 | } |
29 | ~DocumentAccessor(); | |
30 | char StyleAt(int position); | |
31 | int GetLine(int position); | |
32 | int LineStart(int line); | |
33 | int LevelAt(int line); | |
34 | int Length(); | |
35 | void Flush(); | |
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); | |
40 | } | |
41 | ||
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); | |
49 | }; |