namespace vase.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "internal/vase/buffer/append.h"
|
||||
#include "internal/vase/vase.h"
|
||||
|
||||
namespace crib::internal::vase {
|
||||
AppendBuffer::AppendBuffer(std::filesystem::path base_dir) {
|
||||
base_dir /= "tapp.XXXXXX";
|
||||
char *s = strdup(base_dir.c_str());
|
||||
@@ -68,3 +69,4 @@ const char *AppendBuffer::read(uint64_t pos) {
|
||||
uint64_t AppendBuffer::length() {
|
||||
return current_size;
|
||||
}
|
||||
} // namespace crib::internal::vase
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "internal/vase/buffer/original.h"
|
||||
#include "internal/vase/vase.h"
|
||||
|
||||
namespace crib::internal::vase {
|
||||
OriginalBuffer::OriginalBuffer(std::filesystem::path base_dir) {
|
||||
if (!std::filesystem::exists(base_dir) || !std::filesystem::is_directory(base_dir))
|
||||
throw std::runtime_error("Swap directory does not exist or is not a directory.");
|
||||
@@ -43,3 +44,4 @@ const char *OriginalBuffer::read(uint64_t pos) {
|
||||
uint64_t OriginalBuffer::length() {
|
||||
return len;
|
||||
}
|
||||
} // namespace crib::internal::vase
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "internal/vase/iterators/line.h"
|
||||
#include "internal/vase/vase.h"
|
||||
|
||||
namespace crib::internal::vase {
|
||||
LineIterator::LineIterator(Shard *root, uint64_t line_num, Direction dir)
|
||||
: it(root, dir), dir(dir) {
|
||||
it.seek_line(line_num);
|
||||
@@ -71,3 +72,4 @@ bool LineIterator::next(std::string *line) {
|
||||
uint64_t LineIterator::byte_offset() {
|
||||
return last_line_offset;
|
||||
}
|
||||
} // namespace crib::internal::vase
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "internal/vase/iterators/petal.h"
|
||||
#include "internal/vase/vase.h"
|
||||
|
||||
namespace crib::internal::vase {
|
||||
PetalIterator::PetalIterator(Shard *r, Direction dir)
|
||||
: dir(dir), root(r) {
|
||||
if (!root)
|
||||
@@ -156,3 +157,4 @@ bool PetalIterator::next(const char **data, uint64_t *out_len) {
|
||||
uint64_t PetalIterator::byte_offset() {
|
||||
return last_offset;
|
||||
}
|
||||
} // namespace crib::internal::vase
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "internal/vase/vase.h"
|
||||
|
||||
namespace crib::internal::vase {
|
||||
std::vector<ReplacePart> Vase::parse_replace(std::string_view s) {
|
||||
std::vector<ReplacePart> parts;
|
||||
std::string constant;
|
||||
@@ -149,3 +150,4 @@ std::vector<Range> Vase::regex_search(
|
||||
result.push_back({point_of(match.start), point_of(match.end)});
|
||||
return result;
|
||||
}
|
||||
} // namespace crib::internal::vase
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "internal/vase/iterators/petal.h"
|
||||
#include "internal/vase/vase.h"
|
||||
|
||||
namespace crib::internal::vase {
|
||||
std::vector<RegexMatch> Vase::_regex_search(
|
||||
std::string_view pattern, Range range, std::string_view options
|
||||
) {
|
||||
@@ -294,3 +294,4 @@ std::vector<RegexMatch> Vase::_regex_search(
|
||||
|
||||
return results;
|
||||
}
|
||||
} // namespace crib::internal::vase
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "internal/vase/shard.h"
|
||||
#include "internal/vase/vase.h"
|
||||
|
||||
namespace crib::internal::vase {
|
||||
void Shard::retain(Shard *n) {
|
||||
if (n)
|
||||
n->refs++;
|
||||
@@ -256,3 +257,4 @@ Shard *Shard::from_file(std::filesystem::path path, OriginalBuffer *o) {
|
||||
return pieces[0];
|
||||
return build(pieces.data(), 0, pieces.size());
|
||||
}
|
||||
} // namespace crib::internal::vase
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "internal/vase/vase.h"
|
||||
#include "internal/vase/iterators/line.h"
|
||||
#include "internal/vase/iterators/petal.h"
|
||||
|
||||
namespace crib::internal::vase {
|
||||
Vase::Vase(std::filesystem::path path, std::filesystem::path swapdir)
|
||||
: path(path), swapdir(swapdir) {
|
||||
if (!std::filesystem::exists(swapdir) || !std::filesystem::is_directory(swapdir))
|
||||
@@ -397,3 +396,4 @@ void Vase::move_lines(Point *point, uint64_t amount, Direction dir) {
|
||||
}
|
||||
clamp(point);
|
||||
}
|
||||
} // namespace crib::internal::vase
|
||||
|
||||
Reference in New Issue
Block a user