Major refractor
- Add regex search and replace - Add chunk iterator + update line iterator. - Cleanup/formatting.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "../shard.h"
|
||||
#include "pch.h"
|
||||
|
||||
struct ChunkIterator {
|
||||
Shard *root = nullptr;
|
||||
std::vector<Shard *> stack;
|
||||
Petal *petal = nullptr;
|
||||
uint32_t petal_offset = 0;
|
||||
|
||||
ChunkIterator(Shard *r, uint32_t offset = 0);
|
||||
|
||||
~ChunkIterator();
|
||||
|
||||
void seek(uint32_t offset);
|
||||
bool next(const char **data, uint32_t *out_len);
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "../shard.h"
|
||||
#include "chunk.h"
|
||||
#include "pch.h"
|
||||
|
||||
struct LineIterator {
|
||||
uint32_t offset;
|
||||
ChunkIterator it;
|
||||
|
||||
const char *cursor = nullptr;
|
||||
uint32_t remaining = 0;
|
||||
bool eof = false;
|
||||
|
||||
LineIterator(Shard *r, uint32_t start_line);
|
||||
|
||||
~LineIterator();
|
||||
|
||||
bool next(std::string &line);
|
||||
};
|
||||
Reference in New Issue
Block a user