]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/DocumentAccessor.h
48742a9b40564e3a1a7093a4ab889a458c14cedf
[wxWidgets.git] / src / stc / scintilla / src / DocumentAccessor.h
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.
5 **/
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.
8
9 class Document;
10
11 /**
12 */
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; }
17
18 protected:
19 Document *pdoc;
20 PropSet &props;
21 WindowID id;
22 int lenDoc;
23
24 char styleBuf[bufferSize];
25 int validLen;
26 char chFlags;
27 char chWhile;
28 unsigned int startSeg;
29
30 bool InternalIsLeadByte(char ch);
31 void Fill(int position);
32
33 public:
34 DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
35 Accessor(), pdoc(pdoc_), props(props_), id(id_),
36 lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
37 }
38 ~DocumentAccessor();
39 char StyleAt(int position);
40 int GetLine(int position);
41 int LineStart(int line);
42 int LevelAt(int line);
43 int Length();
44 void Flush();
45 int GetLineState(int line);
46 int SetLineState(int line, int state);
47 int GetPropertyInt(const char *key, int defaultValue=0) {
48 return props.GetInt(key, defaultValue);
49 }
50 char *GetProperties() {
51 return props.ToString();
52 }
53 WindowID GetWindow() { return id; }
54
55 void StartAt(unsigned int start, char chMask=31);
56 void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
57 unsigned int GetStartSegment() { return startSeg; }
58 void StartSegment(unsigned int pos);
59 void ColourTo(unsigned int pos, int chAttr);
60 void SetLevel(int line, int level);
61 int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
62 };