Major refractor

- Add regex search and replace
- Add chunk iterator + update line iterator.
- Cleanup/formatting.
This commit is contained in:
2026-07-29 04:50:22 +01:00
parent d8a59a5f5c
commit 15f1456fac
16 changed files with 759 additions and 256 deletions
+2 -14
View File
@@ -9,21 +9,9 @@ struct OriginalBuffer : Buffer {
std::vector<uint32_t> newlines;
// TODO: replace with file io or even lazy loaded file io for large files/logs etc. later.
OriginalBuffer(char *buf, uint32_t length) : buf(buf), length(length) {
const char *p = buf;
const char *end = buf + length;
while (p < end) {
p = (const char *)memchr(p, '\n', end - p);
if (!p)
break;
newlines.push_back(uint32_t(p - buf));
p++;
}
}
OriginalBuffer(char *buf, uint32_t length);
~OriginalBuffer() {
free(buf);
}
~OriginalBuffer();
const char *read(uint32_t pos, uint32_t *out_len);
uint32_t count_lines(uint32_t pos, uint32_t length);