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);
358 static void setMaxLoadedBlocks (uint count);
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);
555 void changeLine(uint i);
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);
587 void setHighlight (uint hlMode);
589 KateHighlighting *highlight () {
return m_highlight; };
594 void invalidateHighlighting();
596 KateCodeFoldingTree *foldingTree () {
return &m_regionTree; };
599 void codeFoldingColumnUpdate(
unsigned int lineNr);
614 bool doHighlight (
KateBufBlock *buf, uint from, uint to,
bool invalidate);
620 void codeFoldingUpdated();
626 void tagLines(
int start,
int end);
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;
KateBufBlock * prev()
prev block
KateTextLine::Ptr line(uint i)
Return line i.
bool editTagFrom() const
line inserted/removed?
bool editChanged() const
were there changes in the current running editing session?
KateBufBlock * last()
last block in this list or 0
The KateBufBlock class contains an amount of data representing a certain number of lines...
bool binary() const
is this file a binary?
KateBufBlock * next()
next block
uint startLine() const
startLine
void insertLine(uint i, KateTextLine::Ptr line)
insert line in front of line i marks the block dirty
list which allows O(1) inserts/removes will not delete the elements on remove will use the next/prevN...
KateBufBlock(KateBuffer *parent, KateBufBlock *prev=0, KateBufBlock *next=0, KateFileLoader *stream=0)
Create an empty block.
KateBufBlock * first()
first block in this list or 0
State state() const
returns the current state of this block
bool isLast(KateBufBlock *buf)
is buf the last block?
void markDirty()
mark this block as dirty, will invalidate the swap data insert/removeLine will mark the block dirty i...
uint editTagStart() const
dirty lines start
uint editTagEnd() const
dirty lines end
void setStartLine(uint line)
update the first line, needed to keep it up to date
uint count() const
count of blocks in this list
uint endLine() const
first line behind this block
bool isFirst(KateBufBlock *buf)
is buf the last block?
bool loadingBorked() const
was the last loading broken because of not enough tmp disk space ? (will be reseted on successful sav...
KateTextLine::Ptr plainLine(uint i)
Return line i without triggering highlighting.
uint lines() const
lines in this block
void removeLine(uint i)
remove line i marks the block dirty
~KateBufBlock()
destroy this block and take care of freeing all mem
uint count() const
Return the total number of lines in the buffer.
static uint maxLoadedBlocks()
maximal loaded block count
KateTextLine::Ptr line(uint i)
return line i The first line of this block is line 0.
The KateBuffer class maintains a collections of lines.