*** empty log message ***
[anjuta-git-plugin.git] / scintilla / DocumentAccessor.h
blobdc591d13ec3142c08216f5451b18e752db0fb6e1
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.
9 class Document;
11 /**
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; }
18 protected:
19 Document *pdoc;
20 PropSet &props;
21 WindowID id;
22 int lenDoc;
24 char styleBuf[bufferSize];
25 int validLen;
26 char chFlags;
27 char chWhile;
28 unsigned int startSeg;
29 int startPosStyling;
31 bool InternalIsLeadByte(char ch);
32 void Fill(int position);
34 public:
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) {
40 ~DocumentAccessor();
41 bool Match(int pos, const char *s);
42 char StyleAt(int position);
43 int GetLine(int position);
44 int LineStart(int line);
45 int LevelAt(int line);
46 int Length();
47 void Flush();
48 int GetLineState(int line);
49 int SetLineState(int line, int state);
50 int GetPropertyInt(const char *key, int defaultValue=0) {
51 return props.GetInt(key, defaultValue);
53 char *GetProperties() {
54 return props.ToString();
56 WindowID GetWindow() { return id; }
58 void StartAt(unsigned int start, char chMask=31);
59 void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
60 unsigned int GetStartSegment() { return startSeg; }
61 void StartSegment(unsigned int pos);
62 void ColourTo(unsigned int pos, int chAttr);
63 void SetLevel(int line, int level);
64 int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);