Rearrange project files.

This commit is contained in:
2026-08-06 20:16:40 +01:00
parent 9841c2cf15
commit 0720a254a3
22 changed files with 16 additions and 70 deletions
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include "../constants.h"
#include "buffer.h"
#include "pch.h"
struct AppendBuffer : Buffer {
char *buf = nullptr;
uint64_t allocated_capacity = 0;
uint64_t current_size = 0;
int fd = -1;
AppendBuffer(std::filesystem::path base_dir);
~AppendBuffer();
uint64_t append(const char c);
uint64_t append(const char *text, uint64_t len);
const char *read(uint64_t pos) override;
uint64_t length() override;
private:
void grow(uint64_t len);
};
+9
View File
@@ -0,0 +1,9 @@
#pragma once
#include "pch.h"
struct Buffer {
virtual const char *read(uint64_t pos) = 0;
virtual uint64_t length() = 0;
virtual ~Buffer() = default;
};
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include "buffer.h"
#include "pch.h"
struct OriginalBuffer : Buffer {
const char *buf;
uint64_t len;
int fd = -1;
OriginalBuffer(std::filesystem::path base_dir);
~OriginalBuffer();
void initialize();
const char *read(uint64_t pos) override;
uint64_t length() override;
};