Add a line content iterator.

This commit is contained in:
2026-07-28 18:01:48 +01:00
parent ed020792f6
commit 9c84118e63
9 changed files with 179 additions and 9 deletions
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include "pch.h"
#include "shard.h"
struct LineIterator {
Shard *root = nullptr;
std::vector<Branch *> stack;
Petal *petal = nullptr;
uint32_t petal_offset = 0;
LineIterator(Shard *r, uint32_t start_line);
~LineIterator();
LineIterator(const LineIterator &) = delete;
LineIterator &operator=(const LineIterator &) = delete;
LineIterator(LineIterator &&) = default;
LineIterator &operator=(LineIterator &&) = default;
void seek_line(uint32_t line_index);
bool next(std::string &line);
private:
void descend(Shard *s);
bool advance_petal();
};