summaryrefslogtreecommitdiff
path: root/src/buffer.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2021-11-17 22:34:57 +0100
committerJoel Klinghed <the_jk@spawned.biz>2021-11-17 22:34:57 +0100
commit6232d13f5321b87ddf12a1aa36b4545da45f173d (patch)
tree23f3316470a14136debd9d02f9e920ca2b06f4cc /src/buffer.hh
Travel3: Simple image and video display site
Reads the images and videos from filesystem and builds a site in memroy.
Diffstat (limited to 'src/buffer.hh')
-rw-r--r--src/buffer.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/buffer.hh b/src/buffer.hh
new file mode 100644
index 0000000..7f11a7c
--- /dev/null
+++ b/src/buffer.hh
@@ -0,0 +1,25 @@
+#ifndef BUFFER_HH
+#define BUFFER_HH
+
+#include "ro_buffer.hh"
+
+#include <memory>
+
+class Buffer : public RoBuffer {
+public:
+ static std::unique_ptr<Buffer> fixed(size_t size);
+ static std::unique_ptr<Buffer> growing(size_t base_size, size_t max_size);
+ // Acts as /dev/null, ie always empty, can write anything to it.
+ static std::unique_ptr<Buffer> null();
+
+ virtual bool full() const = 0;
+
+ virtual void clear() = 0;
+
+ virtual char* wbuf(size_t request, size_t& avail) = 0;
+ virtual void wcommit(size_t bytes) = 0;
+
+ static size_t write(Buffer* buf, void const* data, size_t len);
+};
+
+#endif // BUFFER_HH