Rearrange project files.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user