8c61f186cf
- ChunkIterator is now bidirectional - LineIterator is now also bidirectional - Undo/redo history operations - Replace operation - Range based api functions - And more minor bug fixes
28 lines
511 B
C++
28 lines
511 B
C++
#pragma once
|
|
|
|
#include "../shard.h"
|
|
#include "pch.h"
|
|
|
|
enum struct Direction : uint8_t {
|
|
Forward,
|
|
Backward
|
|
};
|
|
|
|
struct ChunkIterator {
|
|
Direction dir;
|
|
Shard *root = nullptr;
|
|
std::vector<Shard *> stack;
|
|
Petal *petal = nullptr;
|
|
uint32_t petal_offset = 0;
|
|
uint32_t global_offset = 0;
|
|
|
|
ChunkIterator(Shard *r, Direction dir);
|
|
|
|
~ChunkIterator();
|
|
|
|
void seek_offset(uint32_t offset);
|
|
void seek_line(uint32_t offset);
|
|
bool next(const char **data, uint32_t *out_len);
|
|
uint32_t byte_offset();
|
|
};
|