edbee - Qt Editor Library
Public Member Functions | List of all members
edbee::RangeLineIterator Class Reference

Implements a line iterator for a single range It iterates over all affected lines that are inside the given textrange. More...

#include <rangelineiterator.h>

+ Collaboration diagram for edbee::RangeLineIterator:

Public Member Functions

 RangeLineIterator (TextDocument *doc, const TextRange &range)
 Constructs the range line iterator. More...
 
 RangeLineIterator (TextDocument *doc, int start, int end)
 Constructs a line iterator by supplying two offsets. More...
 
bool hasNext () const
 Checks if there's a next line number available. More...
 
int next ()
 returns the next line number More...
 

Detailed Description

Implements a line iterator for a single range It iterates over all affected lines that are inside the given textrange.

Warning you should not change the document in such way that the linecount changes Doing this will result in incorrect behavior of this iterator

Usage sample:

RangeLineIterator itr( &controller->textSelection().range(0) )
while( itr.hasNext() ) {
qDebug() << "Line: " << itr.next();
}

Constructor & Destructor Documentation

◆ RangeLineIterator() [1/2]

edbee::RangeLineIterator::RangeLineIterator ( TextDocument doc,
const TextRange range 
)

Constructs the range line iterator.

Parameters
docthe textdocument this iterator is used for
rangethe range to iterate over the lines

◆ RangeLineIterator() [2/2]

edbee::RangeLineIterator::RangeLineIterator ( TextDocument doc,
int  startOffset,
int  endOffset 
)

Constructs a line iterator by supplying two offsets.

Parameters
docthe textdocument for this iterator
startOffsetthe start offset for iterating
endOffsetthe endOffset for iterating

Member Function Documentation

◆ hasNext()

bool edbee::RangeLineIterator::hasNext ( ) const

Checks if there's a next line number available.

◆ next()

int edbee::RangeLineIterator::next ( )

returns the next line number


The documentation for this class was generated from the following files: