// BufferAccessor.h // Copyright (C) 2004 Active State Corporation. All rights reserved. // Shut up annoying Visual C++ warnings: #ifdef _MSC_VER #ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE #endif #endif #include #include #include #include #include class BufferAccessor : public Accessor { protected: const char* p_buffer; int size_p_buffer; unsigned int startSeg; void Fill(int position); bool InternalIsLeadByte(char ch); private: int CoordinateNumLines; bool _DumpFoldLevels; bool Verbose; public: int* p_colors; int* p_FoldLevels; int* p_NewlinePoints; int NumLines; BufferAccessor(const char* buffer, bool DumpFoldLevels, bool _verbose=false); ~BufferAccessor(); 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); int GetPropertyInt(const char *key, int defaultValue=0); virtual char *GetProperties(); void StartAt(unsigned int start, char chMask=31); void SetFlags(char chFlags_, char chWhile_); unsigned int GetStartSegment(); void StartSegment(unsigned int pos); virtual void ColourTo(unsigned int pos, int chAttr); void SetLevel(int line, int level); int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); }; #ifndef PLATFORM_ASSERT #define PLATFORM_ASSERT ASSERT #endif