void LocationTable::splitByAnchors(const PreprocessedContents& text, const Anchor& textStartPosition, QList<PreprocessedContents>& strings, QList<Anchor>& anchors) const { Anchor currentAnchor = Anchor(textStartPosition); size_t currentOffset = 0; QMapIterator<std::size_t, Anchor> it = m_offsetTable; while (currentOffset < (size_t)text.size()) { Anchor nextAnchor(KDevelop::CursorInRevision::invalid()); size_t nextOffset; if(it.hasNext()) { it.next(); nextOffset = it.key(); nextAnchor = it.value(); }else{ nextOffset = text.size(); nextAnchor = Anchor(KDevelop::CursorInRevision::invalid()); } if( nextOffset-currentOffset > 0 ) { strings.append(text.mid(currentOffset, nextOffset-currentOffset)); anchors.append(currentAnchor); } currentOffset = nextOffset; currentAnchor = nextAnchor; } }