summaryrefslogtreecommitdiff
path: root/src/buffer.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-09-10 22:12:22 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-09-10 22:12:22 +0200
commit32e14551a90e85000e41b3f0445d34d58a1431e4 (patch)
tree912c1e50b93b501446b1b179ee2a3e93586fb854 /src/buffer.hh
parentcf99d0c865474105c14b2348fdbd1c83d87d5a29 (diff)
Add unicode general category lookup
Generate the lookup tables from UnicodeData.txt, do to that, add gen_ugc, which uses csv, buffers, line, io and other modules to do the job.
Diffstat (limited to 'src/buffer.hh')
-rw-r--r--src/buffer.hh31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/buffer.hh b/src/buffer.hh
new file mode 100644
index 0000000..685cd36
--- /dev/null
+++ b/src/buffer.hh
@@ -0,0 +1,31 @@
+#ifndef BUFFER_HH
+#define BUFFER_HH
+
+#include <cstddef>
+#include <memory>
+
+class Buffer {
+ public:
+ virtual ~Buffer() = default;
+
+ virtual void const* rptr(size_t& avail, size_t need = 1) = 0;
+ virtual void consume(size_t size) = 0;
+
+ virtual void* wptr(size_t& avail, size_t need = 1) = 0;
+ virtual void commit(size_t size) = 0;
+
+ [[nodiscard]] virtual bool full() const = 0;
+ [[nodiscard]] virtual bool empty() const = 0;
+
+ [[nodiscard]]
+ static std::unique_ptr<Buffer> fixed(size_t size);
+ [[nodiscard]]
+ static std::unique_ptr<Buffer> dynamic(size_t start_size, size_t max_size);
+
+ protected:
+ Buffer() = default;
+ Buffer(Buffer const&) = delete;
+ Buffer& operator=(Buffer const&) = delete;
+};
+
+#endif // BUFFER_HH