2005-11-22 12:26:26 +00:00
|
|
|
// Scintilla source code edit control
|
|
|
|
/** @file DocumentAccessor.h
|
|
|
|
** Implementation of BufferAccess and StylingAccess on a Scintilla
|
|
|
|
** rapid easy access to contents of a Scintilla.
|
|
|
|
**/
|
|
|
|
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
|
|
|
// The License.txt file describes the conditions under which this software may be distributed.
|
|
|
|
|
2007-06-18 13:02:34 +00:00
|
|
|
#ifdef SCI_NAMESPACE
|
|
|
|
namespace Scintilla {
|
|
|
|
#endif
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
class Document;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
2010-03-07 10:31:51 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
class DocumentAccessor : public Accessor {
|
|
|
|
// Private so DocumentAccessor objects can not be copied
|
2010-03-07 10:31:51 +00:00
|
|
|
DocumentAccessor(const DocumentAccessor &source);
|
|
|
|
DocumentAccessor &operator=(const DocumentAccessor &);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Document *pdoc;
|
2010-03-07 10:31:51 +00:00
|
|
|
PropertyGet &props;
|
2005-11-22 12:26:26 +00:00
|
|
|
WindowID id;
|
|
|
|
int lenDoc;
|
|
|
|
|
|
|
|
char styleBuf[bufferSize];
|
|
|
|
int validLen;
|
|
|
|
char chFlags;
|
|
|
|
char chWhile;
|
|
|
|
unsigned int startSeg;
|
|
|
|
int startPosStyling;
|
|
|
|
int mask;
|
|
|
|
|
|
|
|
bool InternalIsLeadByte(char ch);
|
|
|
|
void Fill(int position);
|
|
|
|
|
|
|
|
public:
|
2010-06-06 18:34:26 +00:00
|
|
|
DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) :
|
2005-11-22 12:26:26 +00:00
|
|
|
Accessor(), pdoc(pdoc_), props(props_), id(id_),
|
2010-06-06 18:34:26 +00:00
|
|
|
lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
|
2005-11-22 12:26:26 +00:00
|
|
|
startSeg(0), startPosStyling(0),
|
|
|
|
mask(127) { // Initialize the mask to be big enough for any lexer.
|
|
|
|
}
|
|
|
|
~DocumentAccessor();
|
|
|
|
bool Match(int pos, const char *s);
|
|
|
|
char StyleAt(int position);
|
|
|
|
int GetLine(int position);
|
|
|
|
int LineStart(int line);
|
|
|
|
int LevelAt(int line);
|
|
|
|
int Length();
|
|
|
|
void Flush();
|
|
|
|
int GetLineState(int line);
|
|
|
|
int SetLineState(int line, int state);
|
2010-06-06 18:34:26 +00:00
|
|
|
int GetPropertyInt(const char *key, int defaultValue=0) {
|
|
|
|
return props.GetInt(key, defaultValue);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
char *GetProperties() {
|
|
|
|
return props.ToString();
|
|
|
|
}
|
|
|
|
WindowID GetWindow() { return id; }
|
|
|
|
|
|
|
|
void StartAt(unsigned int start, char chMask=31);
|
2010-06-06 18:34:26 +00:00
|
|
|
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }
|
2005-11-22 12:26:26 +00:00
|
|
|
unsigned int GetStartSegment() { return startSeg; }
|
|
|
|
void StartSegment(unsigned int pos);
|
|
|
|
void ColourTo(unsigned int pos, int chAttr);
|
|
|
|
void SetLevel(int line, int level);
|
|
|
|
int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
|
2007-06-18 13:02:34 +00:00
|
|
|
void IndicatorFill(int start, int end, int indicator, int value);
|
2005-11-22 12:26:26 +00:00
|
|
|
};
|
2007-06-18 13:02:34 +00:00
|
|
|
|
|
|
|
#ifdef SCI_NAMESPACE
|
|
|
|
}
|
|
|
|
#endif
|