20 #ifndef __KATE_BUFFER_H__
21 #define __KATE_BUFFER_H__
23 #include "katetextline.h"
24 #include "katecodefoldinghelpers.h"
26 #include <kvmallocator.h>
28 #include <tqptrlist.h>
31 #include <tqvaluevector.h>
35 class KateHighlighting;
62 KateFileLoader *stream = 0 );
74 void fillBlock (KateFileLoader *stream);
141 inline uint
endLine ()
const {
return m_startLine + m_lines; }
147 inline uint
lines ()
const {
return m_lines; }
195 KVMAllocator::Block *m_vmblock;
205 TQValueVector<KateTextLine::Ptr> m_stringList;
261 inline uint
count()
const {
return m_count; }
303 buf->list->removeInternal (buf);
364 static uint m_maxLoadedBlocks;
418 uint editSessionNumber;
428 uint editTagLineStart;
438 bool editTagLineFrom;
443 bool editChangesDone;
456 bool openFile (
const TQString &m_file);
469 bool binary ()
const {
return m_binary; }
482 bool saveFile (
const TQString &m_file);
494 if (i < m_lineHighlighted)
497 return line_internal (buf, i);
506 inline void addIndentBasedFoldingInformation(TQMemArray<uint> &foldingList,
bool addindent,uint deindent);
507 inline void updatePreviousNotEmptyLine(
KateBufBlock *blk,uint current_line,
bool addindent,uint deindent);
524 inline uint
count()
const {
return m_lines; }
538 if ((m_blocks[m_lastFoundBlock]->
startLine() <= i) && (m_blocks[m_lastFoundBlock]->
endLine() > i))
541 (*index) = m_lastFoundBlock;
543 return m_blocks[m_lastFoundBlock];
546 return findBlock_internal (i, index);
549 KateBufBlock *findBlock_internal (uint i, uint *index = 0);
568 inline uint countVisible () {
return m_lines - m_regionTree.getHiddenLinesCount(m_lines); }
570 inline uint lineNumber (uint visibleLine) {
return m_regionTree.getRealLine (visibleLine); }
572 inline uint lineVisibleNumber (uint
line) {
return m_regionTree.getVirtualLine (
line); }
574 inline void lineInfo (KateLineInfo *info,
unsigned int line) { m_regionTree.getLineInfo(info,
line); }
576 inline uint tabWidth ()
const {
return m_tabWidth; }
579 void setTabWidth (uint w);
589 KateHighlighting *highlight () {
return m_highlight; };
596 KateCodeFoldingTree *foldingTree () {
return &m_regionTree; };
599 void codeFoldingColumnUpdate(
unsigned int lineNr);
614 bool doHighlight (
KateBufBlock *buf, uint from, uint to,
bool invalidate);
643 TQValueVector<KateBufBlock*> m_blocks;
648 uint m_lastInSyncBlock;
653 uint m_lastFoundBlock;
659 bool m_cacheReadError;
660 bool m_cacheWriteError;
665 bool m_loadingBorked;
679 KateHighlighting *m_highlight;
684 KateCodeFoldingTree m_regionTree;
689 uint m_lineHighlightedMax;
690 uint m_lineHighlighted;
695 uint m_maxDynamicContexts;
uint startLine() const
startLine
void setHighlight(uint hlMode)
Use highlight for highlighting.
void markDirty()
mark this block as dirty, will invalidate the swap data insert/removeLine will mark the block dirty i...
KateBuffer(KateDocument *doc)
Create an empty buffer.
void setStartLine(uint line)
update the first line, needed to keep it up to date
bool editChanged() const
were there changes in the current running editing session?
void editStart()
start some editing action
void editEnd()
finish some editing action
bool openFile(const TQString &m_file)
Open a file, use the given filename.
list which allows O(1) inserts/removes will not delete the elements on remove will use the next/prevN...
void tagLines(int start, int end)
Emitted when the highlighting of a certain range has changed.
bool canEncode()
Can the current codec handle all chars.
KateBufBlock * prev()
prev block
uint editTagEnd() const
dirty lines end
void insertLine(uint i, KateTextLine::Ptr line)
insert line in front of line i marks the block dirty
~KateBuffer()
Goodbye buffer.
KateBufBlockList()
Default Constructor.
uint endLine() const
first line behind this block
uint count() const
count of blocks in this list
KateTextLine::Ptr plainLine(uint i)
Return line i without triggering highlighting.
void codeFoldingUpdated()
Emittend if codefolding returned with a changed list.
void insertLine(uint i, KateTextLine::Ptr line)
Insert line in front of line i.
~KateBufBlock()
destroy this block and take care of freeing all mem
uint count() const
Return the total number of lines in the buffer.
void changeLine(uint i)
Mark line i as changed !
bool isFirst(KateBufBlock *buf)
is buf the last block?
void invalidateHighlighting()
Invalidate highlighting of whole buffer.
static uint maxLoadedBlocks()
maximal loaded block count
bool binary() const
is this file a binary?
KateTextLine::Ptr line(uint i)
return line i The first line of this block is line 0.
void removeLine(uint i)
Remove line i.
The KateBuffer class maintains a collections of lines.
KateBufBlock * last()
last block in this list or 0
The KateBufBlock class contains an amount of data representing a certain number of lines.
KateBufBlock * first()
first block in this list or 0
uint editTagStart() const
dirty lines start
void removeLine(uint i)
remove line i marks the block dirty
bool isLast(KateBufBlock *buf)
is buf the last block?
bool saveFile(const TQString &m_file)
Save the buffer to a file, use the given filename + codec + end of line chars (internal use of qtexts...
bool loadingBorked() const
was the last loading broken because of not enough tmp disk space ? (will be reseted on successful sav...
bool editTagFrom() const
line inserted/removed?
KateBufBlock * next()
next block
static void setMaxLoadedBlocks(uint count)
modifier for max loaded blocks limit
static void remove(KateBufBlock *buf)
remove the block from the list it belongs to !
void append(KateBufBlock *buf)
append a block to this list ! will remove it from the list it belonged before !
KateTextLine::Ptr line(uint i)
Return line i.
uint lines() const
lines in this block
KateBufBlock(KateBuffer *parent, KateBufBlock *prev=0, KateBufBlock *next=0, KateFileLoader *stream=0)
Create an empty block.
State state() const
returns the current state of this block
void clear()
Clear the buffer.