OSDN Git Service

Add SCI Edit to GitBlameView
[tortoisegit/TortoiseGitJp.git] / ext / scintilla / src / DocumentAccessor.h
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
5  **/\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
8 \r
9 #ifdef SCI_NAMESPACE\r
10 namespace Scintilla {\r
11 #endif\r
12 \r
13 class Document;\r
14 \r
15 /**\r
16  */\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
21 \r
22 protected:\r
23         Document *pdoc;\r
24         PropSet &props;\r
25         WindowID id;\r
26         int lenDoc;\r
27 \r
28         char styleBuf[bufferSize];\r
29         int validLen;\r
30         char chFlags;\r
31         char chWhile;\r
32         unsigned int startSeg;\r
33         int startPosStyling;\r
34         int mask;\r
35 \r
36         bool InternalIsLeadByte(char ch);\r
37         void Fill(int position);\r
38 \r
39 public:\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
45         }\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
52         int Length();\r
53         void Flush();\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
58         }\r
59         char *GetProperties() {\r
60                 return props.ToString();\r
61         }\r
62         WindowID GetWindow() { return id; }\r
63 \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
72 };\r
73 \r
74 #ifdef SCI_NAMESPACE\r
75 }\r
76 #endif\r