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;
list which allows O(1) inserts/removes will not delete the elements on remove will use the next/prevN...
KateBufBlock * last()
last block in this list or 0
KateBufBlockList()
Default Constructor.
KateBufBlock * first()
first block in this list or 0
bool isLast(KateBufBlock *buf)
is buf the last block?
uint count() const
count of blocks in this list
bool isFirst(KateBufBlock *buf)
is buf the last block?
void append(KateBufBlock *buf)
append a block to this list ! will remove it from the list it belonged before !
static void remove(KateBufBlock *buf)
remove the block from the list it belongs to !
The KateBufBlock class contains an amount of data representing a certain number of lines.
~KateBufBlock()
destroy this block and take care of freeing all mem
void setStartLine(uint line)
update the first line, needed to keep it up to date
KateBufBlock * prev()
prev block
void markDirty()
mark this block as dirty, will invalidate the swap data insert/removeLine will mark the block dirty i...
KateTextLine::Ptr line(uint i)
return line i The first line of this block is line 0.
void removeLine(uint i)
remove line i marks the block dirty
State state() const
returns the current state of this block
uint endLine() const
first line behind this block
void insertLine(uint i, KateTextLine::Ptr line)
insert line in front of line i marks the block dirty
KateBufBlock * next()
next block
uint lines() const
lines in this block
uint startLine() const
startLine
KateBufBlock(KateBuffer *parent, KateBufBlock *prev=0, KateBufBlock *next=0, KateFileLoader *stream=0)
Create an empty block.
The KateBuffer class maintains a collections of lines.
bool openFile(const TQString &m_file)
Open a file, use the given filename.
~KateBuffer()
Goodbye buffer.
void tagLines(int start, int end)
Emitted when the highlighting of a certain range has changed.
bool editChanged() const
were there changes in the current running editing session?
void removeLine(uint i)
Remove line i.
uint editTagEnd() const
dirty lines end
bool loadingBorked() const
was the last loading broken because of not enough tmp disk space ? (will be reseted on successful sav...
uint count() const
Return the total number of lines in the buffer.
bool binary() const
is this file a binary?
void clear()
Clear the buffer.
bool canEncode()
Can the current codec handle all chars.
bool editTagFrom() const
line inserted/removed?
void changeLine(uint i)
Mark line i as changed !
void insertLine(uint i, KateTextLine::Ptr line)
Insert line in front of line i.
void setHighlight(uint hlMode)
Use highlight for highlighting.
KateBuffer(KateDocument *doc)
Create an empty buffer.
void editEnd()
finish some editing action
uint editTagStart() const
dirty lines start
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...
KateTextLine::Ptr line(uint i)
Return line i.
KateTextLine::Ptr plainLine(uint i)
Return line i without triggering highlighting.
void codeFoldingUpdated()
Emittend if codefolding returned with a changed list.
static void setMaxLoadedBlocks(uint count)
modifier for max loaded blocks limit
void invalidateHighlighting()
Invalidate highlighting of whole buffer.
void editStart()
start some editing action
static uint maxLoadedBlocks()
maximal loaded block count